+ 1
stuck on "working with input" section under strings and variables for python
I keep getting this error when trying to pass this part of the course. My goal is to output the input x repeated y times. Any help would be appreciated. Traceback (most recent call last): File "/usercode/file0.py", line 3, in <module> print(x*y) TypeError: can't multiply sequence by non-int of type 'str'
2 Antworten
+ 10
Looks like you multiplied a string by a string.
We have to use int() function to declare an integer as an input like this
X = int(input)
print(X)
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/4434/
+ 6
Did you convert input for <y> into an integer? it seems both <x> and <y> were taken as string there.
y = int(input("Enter value of y:"))