0

How do you run a code that requires user input?

I'm not really sure how to run a code that requires user input in the playground. My example would just be a simple input line in python, like num = input(":") If I were to run this, for example, it then would show a box that says, "Seems like your code requires input," with a text box beneath it. If I just simply enter what my input would be there, then it raises the error, "TypeError: unsupported operand type(s) for /: 'str' and 'int'." Anyone know the solution to this and how to do user inputs?

16th Sep 2020, 6:50 AM
Tanner
Tanner - avatar
2 ответов
+ 2
You have to enter all the inputs that you need at the start of the program separated by new line, about the error you have to show the code.. input always return string value so for example if you want to do arithmetics with it you should convert it to int by using num = int(input(':'))
16th Sep 2020, 6:56 AM
Ruba Kh
Ruba Kh - avatar
+ 1
num=input() doesn't gives any error ,and input returns a string
16th Sep 2020, 6:53 AM
Abhay
Abhay - avatar