+ 1
Python coding playground help please
I am trying to practice coding in python but it keeps on having this message when I hit ârunâ This is the pop up message: Looks like tour program needs input Use new lines to separate multiple input I am practicing input and output and I cannot see my desired output :( Sample code: name = input(âenter name:â) print(âHi â + name)
7 Respostas
+ 4
The message you're seeing indicates that your program is expecting input from the user, but you haven't provided any input. The input() function in Python waits for the user to enter something before proceeding.
In your sample code, when you run it, the program prompts you to enter a name with the message "enter name:". However, if you're running the code in an environment that doesn't provide an interactive console, such as a basic text editor or an online code editor, you won't be able to enter the input directly.
To work around this issue, you can modify your code slightly to provide the input directly in the code itself. Here's an example:
name = input("enter name:")
print("Hi " + name)
Change it to:
name = "John" # Replace "John" with your desired input
print("Hi " + name)
By assigning a value directly to the name variable, you can simulate the input without requiring user interaction. In this example, "John" is used as the input, but you can replace it with any desired name or input value.
By making this modification, you should be able to see the desired output without encountering the input prompt message.
+ 6
It happen because the program dont run on your device but on remote server, you have to provide the input before the run and the server make it avaible to program at runtime. In practice, you will not have real-interactive programs with sl playground (except using html/js codes that will run on your device)
+ 6
You can see this code to understand how input/output works in Playground
https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
+ 3
Thanks so much for the clarifications Hazem Hadj Ahmed Ipang KrOW :) I am using my mobile now to practice code and tried a python IDE app and the input works
0
Have you added your input? If yes, then please share the code in here.
0
Danish Zubair I canât add an input() in sololearn as what the responses in the thread say. I have added the code in an IDE and it works fine for me
0
Bea Ramillano You can't display the input text in Sololearn, when the input is asked, but the input text still shows in the console once the input is asked. You can still ask for input, in Sololearn. This is an example of that:
https://code.sololearn.com/cof9mjVqWdxQ/?ref=app