+ 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'

27th Jan 2021, 7:22 AM
Austin Lepari
Austin Lepari - avatar
2 odpowiedzi
+ 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/
27th Jan 2021, 7:39 AM
Simba
Simba - avatar
+ 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:"))
27th Jan 2021, 7:36 AM
Ipang