08.inoutput
1.inputoutput
name = input()
print(name)
김길동
김길동
name = input("당신의 이름은? > ")
print("하이!!", name)
당신의 이름은? > 고길동
하이!! 고길동
num1 = input() # input()의 결과값의 타입은 문자열(str)
num2 = input()
print(num1 * num2) # TypeError: can't multiply sequence by non-int of type 'str'
print(num1 + num2) # "10" + "20" = 1020
10
20
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3028/1563437866.py in <module>
2 num2 = input()
3
----> 4 print(num1 * num2) # TypeError: can't multiply sequence by non-int of type 'str'
5 print(num1 + num2) # "10" + "20" = 1020
TypeError: can't multiply sequence by non-int of type 'str'
댓글남기기