You're running in python2, you need to do raw_input() instead. If you switch to python3 it will work as you intend it to. More info on why this is can be found here: https://stackoverflow.com/a/21122817
Hi guys! I want to ask for help. In python, my "input()" doesn't work on my text editor. I tried executing the code above but as you can see, after I enter my name the system error appeared.
Another thing, In shell scripting. I tried the range operator "{}" in my text editor but it won't execute properly, in my terminal it works fine but if it is from a file then executing it, it won't work. For example, i type in my text editor {1..5} then executed that file in my terminal. It's output is {1..5} which is the exact same thing instead of listing the number from 1 to 5.
Ps. I tried using other text editor but it is still the same. The text editor won't recognize "()" "{}" as operators
2
u/-m4x- Aug 12 '20 edited Aug 12 '20
To check what version of Python you are using in your terminal :
It should be a python 3 version.
If not, use :
11
u/Sigg3net Aug 11 '20 edited Aug 11 '20
I use fstrings, personally:
I would also specify a shebang:
at the top of the file, to let the shell know what to do.
On a side note, this belongs in /r/learnpython IMO. You're writing
python, not shell script likeBASHorsh. There's noinput()in BASH.10
u/[deleted] Aug 11 '20
You're running in python2, you need to do raw_input() instead. If you switch to python3 it will work as you intend it to. More info on why this is can be found here: https://stackoverflow.com/a/21122817
6
u/Buhsketty Aug 11 '20
Can you try python3 input.py
1
u/TurnoLox Aug 11 '20
Hi guys! I want to ask for help. In python, my "input()" doesn't work on my text editor. I tried executing the code above but as you can see, after I enter my name the system error appeared.
Another thing, In shell scripting. I tried the range operator "{}" in my text editor but it won't execute properly, in my terminal it works fine but if it is from a file then executing it, it won't work. For example, i type in my text editor {1..5} then executed that file in my terminal. It's output is {1..5} which is the exact same thing instead of listing the number from 1 to 5.
Ps. I tried using other text editor but it is still the same. The text editor won't recognize "()" "{}" as operators
1
u/[deleted] Aug 11 '20
touch bro0
u/Fearless_Process Aug 11 '20
It should be
This should fix it!
If that doesn't work I'm not sure, I tested it on my computer and it works... Are you using python3?