How to receive input and print it using Python? -
i have written following code:
name = input("what name: ") print(name)
it giving below error when input name
/usr/bin/python2.7 /home/sreedhar/pycharmprojects/sample1/sample.py name: sree traceback (most recent call last): file "/home/sreedhar/pycharmprojects/sample1/sample.py", line 1, in name = input("what name: ") file "", line 1, in nameerror: name 'sree' not defined
process finished exit code 1
can body me debug code, have started python today. , i'm using python community 17.2 on linux mint this.
use raw_input
instead:
name = raw_input("what name: ") print(name)
see python 2.7 getting user input , manipulating string without quotations
input
works on python 3.x, not in 2.x
Comments
Post a Comment