I was learning python as a beginner through YouTube. In the video I was following the output was shown in terminal, but not in my case. It doesn’t even accept taking in data for the variable. What am I doing wrong?
the code was simply :
a = input("Enter name")
print(a)
but the output would only show the text, but wont let me type the input
2
Answers
You code should be working fine. Maybe, you are trying to edit the text
Enter name
, which is not possible in the terminal.Try typing the name and pressing
<Enter>
when the textEnter name
shows up.You can test it here: https://pythonsandbox.com/code/pythonsandbox_u20054_20A4kkNBC961W5aZFb2NJCBW_v0.py
But keep in mind that this is running on the web, not in a terminal, so it will show an input box in which you can input the data.
Firstly, please ensure that you installed Python extension.
Then you can run the file by click Run Python File button.
If you install the code-runner extension and use Run Code button. You need to add the following code to your settings.json (shortcuts "Ctrl+shift+P" and type Preferences : Open User Settings):
By the way, read docs is a good choice.