I get nothing when use input function on python 3.6 [duplicate] - python

This question already has answers here:
Can't send input to running program in Sublime Text
(5 answers)
Closed 3 years ago.
I am trying something very simple but my code just stuck or it is a problem with the print input function. So this is my code
variable = input("Enter something: ")
print(variable)
When I run my script e get nothing. This is the output:
Enter something: try
And it just stuck. Nothing is printed. I do not know what is the problem and do not think that there is a coding problem.

Sublime text 3 has some build problems with its command palette. I just tried this code with sublime and faced the same problem.
Use command prompt(if windows) or terminal(if linux) with following command:
python <filename>.py
Or open this file with python IDLE and use F5 key to run the script.

Related

How can I run my Python file using PyCharm terminal? [duplicate]

This question already has answers here:
How to execute Python scripts in Windows?
(9 answers)
Closed 1 year ago.
I tried to update my PyCharm but it got corrupted so I had to reinstall the program, since doing so I lost my previous settings.
Before, I used to be able to enter a file name into the Terminal (Not Python Console) and the code would run.
E.g I have a file named code.py, I could enter 'code' and it would run and print the statement.
print("Hello World")
But now when I try this, the Terminal returns no print statement output and simply opens up the code.py tab on PyCharm. What settings do I need to change? I have included a screenshot.
Open the terminal and type:
python code.py
i hope you already know how to open a terminal in pycharm so after doing that simply run the command that you want to run your code with, in this case it will be:
python code.py

Sublime Text python error [duplicate]

This question already has answers here:
How to run a python code on sublime text 3?
(2 answers)
Closed 4 years ago.
I've recently stared using sublime text for python and have a little problem. Whenever i try to run my program within sublime using CTRL+B. I get the following error:
'python' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
I tried reinstalling python to C:\Python37-64 but the problem still persists.
Can anyone help?
Add Python to your Windows Path
Installing Python

Pycharm Command Line Codes [duplicate]

This question already has answers here:
Pycharm and sys.argv arguments
(12 answers)
Closed 5 years ago.
I recently just downloaded PyCharm, and I want to get to know it better, however, codes that I would normally run through the terminal, like an argument parser, I no longer know how to do. Here is an example of what I would put into my command line:
python read_in_data -w wide_data_set -s row_number -o output_path
This would then run the code with my given arguments.
Any basic tips on PyCharm would be helpful, as I am very new to it.
(Top of your screen) Go to Run > Edit Configurations, then enter the command line arguments into the "Script parameters" box. These will then be used when you run the code.
For basic tips/an intro to PyCharm - see the tutorial videos on their website.

Execute Python in Sublime Text 3 [duplicate]

This question already has an answer here:
How do I run python from Sublime text 3?
(1 answer)
Closed 6 years ago.
How can I execute Python 2.7 code using Sublime Text 3 on Windows 10? When I use the shortcut Ctrl+B it says 'python' is not recognized as an internal or external command, operable program or batch file. I can't edit python.sublime-build because as far as I know it does not exist in Sublime Text 3.
EDIT: I see this question is a duplicate. I did not see the post when I searched up the topic for some reason.
You need to add python to your system path or if you already have there is a chance that
that in C:\Windows there is exe with python icon called "py" rename it to "python" and it should work fine.

Sublime Text 3 Python Interactive Console? [duplicate]

This question already has answers here:
Can't send input to running program in Sublime Text
(5 answers)
Closed 6 years ago.
I have been using a lot of sublime text 3 to write python. However, whenever a program I make needs user input, nothing happens. For example:
number = input("What is your favorite number?: ")
print(number)
This simply gives me the input prompt in the console, but anything that I type is ignored. The
print(number)
is never run. Is there a way to use an interactive console for sublime text 3? I have heard of something called REPL that will do the job in ST2, but I want to use an interactive console for python3 in ST3.
As of now, I just run programs that need input from terminal. Sometimes I'll use Pycharm, but I'm still getting used to pycharm.
SublimeREPL works for python3. Their current builds are actually all tested against ST3.
https://github.com/wuub/SublimeREPL

Categories