Sardar Ali
Sardar Ali

Reputation: 1

Pressing enter doesn't send input

Hi I am a beginner to Python. I am writing the following sample code for input but when I press Enter after entering value for input command, the program doesn't go forward after printing the first line. I've done it in both Atom and Sublime Text. A basic print statement works perfect.

print ("hello")
x = input("Enter value")
print(x)

Upvotes: 0

Views: 2340

Answers (2)

Ibrahim Almahfooz
Ibrahim Almahfooz

Reputation: 317

Sublime does not support user input unless you install a third-party plugin. And Atom is no different.

If you like to input values interactively, I would suggest running your script from the app Python IDLE then go to file and open your Python script and run it.

Or, alternatively, open a CMD (if you are PC user) or Terminal (in case of MacOS) and execute your script directly from the command line interface, like below:

python yourscript.py

Upvotes: 1

Siyam Ahmed
Siyam Ahmed

Reputation: 24

may be the problem is with the code editor. Try running the file using cmd if you are on windows or terminal on mac/linux.

python file_name.py

Upvotes: 0

Related Questions