0

Input in Python

Hello! It would be great, if someone could give me a hint to manage my problem. I want to make my python program more "interactive". At the python course examples, the input function always was used at the beginning. So with this input you can go through the code line by line and use this input at some point. If I am the guy who wrote the code every thing is fine. But if (as a user) I don't know what the program is doing and then a input window comes up and asks me for "multiple line input" I can only guess what i should write in there. (my name/age/some other numbers...) - the consequence is that the code maybe will not work properly. So is there a posibillity to change the standart text in that window and ask more precisely? Is it the same if i would work at the computer? Thanks ;)

15th Mar 2019, 12:57 AM
Harry Potter Python
Harry Potter Python - avatar
4 odpowiedzi
+ 3
You can't change the text written on SL's input window. However, if you use an IDE that supports multiple inputs during a program the text written inside the input() function will pop up before entering it. A possible solution for this problem is to include comments at the very top of your code explaining what the required inputs are and what the code does with them.
15th Mar 2019, 1:20 AM
Diego
Diego - avatar
+ 1
Is this what you are looking for: name = input("Enter your name") age = input("Enter your age") # etc.
15th Mar 2019, 1:19 AM
Nikunj Arora
Nikunj Arora - avatar
0
Diego ok nice. So is it normal, that I cant see the text inside the input function @ the Sololearn playground because there is an other IDE used? When I code something like this: name = input("Whats your name?") # user enters eg. : Max #output: Whats your name? Max It only appears in the console after the Input. so the text inside the input() is useless - isnt it?
15th Mar 2019, 7:13 AM
Harry Potter Python
Harry Potter Python - avatar
0
Not entirely useless, I'd say. For those who are a bit more experienced in Python those messages may be helpful for understanding your code.
15th Mar 2019, 7:18 AM
Diego
Diego - avatar