Python Input in Code Playground | Sololearn: Learn to code for FREE!


Python Input in Code Playground

My code is: age = input("What is your age? \n") print ("Your age is " + age) However, when receiving user input, it doesn't state the text for the input until after the user gives an input. In the input box, it simply says "Seems like your program requires input" Is there a different kind of input in Python that acts more like a prompt in JS? I don't really understand how getting input from the user is helpful if they don't know the specific reason they are giving input.

1/21/2019 3:25:49 AM


6 Answers

New Answer


This is how the SL Code Playground operates. If you were to use IDLE, it'd do what you are asking for.


age = int(input("what is your age")) print ("your age is" + age)


It's a problem with other languages too in Code playground.


You could use a different IDEA if you want to see that. This is Solo learn Code Playground so this is how things work here.


Your code would do, what you intend (but fix the datatype as written above). But "input("") not work korrect on SL. Try the app "Pydroid" for checking your code. The ide in SL dont work in this way. ------------------------------------------------------------------ kk, it seems, this answer isnt enough. Edit: In python, there are different datatypes. In example "a" is datatype string. Try print(type("a")) You see: <class 'str'> in which str means string. input expect the datatype str. So you have to convert it. x = int(input("something")) I recoment Pydroid, cause its a mobile Python ide. You can test, if input("some words") returns the "some words" as promt.


Input func . Input the string data type convert it to integer