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_inputinstead:

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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -