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

+5

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

melzs0627

6 Answers

New Answer

+6

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

+6

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

+5

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

+3

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.

+1

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.

0

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