개인적인 공부/Python
day 1-3 python (문자열 개수 출력 , input Function)
karatejin
2023. 2. 20. 10:09
Instructions
Write a program that prints the number of characters in a user's name. You might need to Google for a function that calculates the length of a string.
e.g.
https://www.google.com/search?q=how+to+get+the+length+of+a+string+in+python+stack+overflow
Warning. Your program should work for different inputs. e.g. any name that you input.
Example Input
Angela
Example Output
6
str = input("What is your name? ")
print(len(str))
결과
python input = Java scanner, Buffered Reader
나의 응용
str = input("Hello? how are you?")
ans = "im fine too thank you"
print((ans))
컴퓨터가 먼저 묻고 내가 답을 하면 다시 컴퓨터가 대답한다.
한번 더 응용
a = input("hello what is you name?" + "/ your Anser : ")
str = input("Hello? " + a + " how are you?" + "/ your Anser : ")
str1 = input("i'm fine too thank you, do you have any question?" + "/ your Anser : ")
str2 = input("it's sunny day! hope to take SunGlasses and take SunBlocks" + "/ your Anser : ")
ans = "see ya"
print((ans))
결과