0
Somebody wrote code to take a string input and output it, repeated 10 times. However, the code results in an error.
How can I solve it because this was given X=input() Print (x +10) While the output is hellohellohellohellohellohellohellohellohellohello
2 ответов
+ 9
You cannot add number with string. It will give error. Use * instead of +
+ 1
x = "3"
print(x+3)
>>>Output: TypeError ( string and integer cannot be added)
x = int(3)
print(x+3)
>>>Output: 6
x = "3"
print(x*10)
>>>Output: 3333333333
x = int(3)
print(x*10)
>>>Output: 30