+ 2

Whats problem on my code in python?

i make this code on code playground like this : s = input ("name pls:") print(s) it work fine, but i try it on pc (python ver 2.7.1+) the output show eror like this: Trace back (most recent call last): s = input ("name pls:") file "<string>" ,line 1 , in <module> NameError :name 'dwi' is not defined please some one help me

25th Jun 2017, 8:14 PM
Dwi Setya
Dwi Setya - avatar
4 Answers
+ 3
With Python before 3 you need to use the raw_input() function rather than the 'input()' one in most of case (to get raw string at return, and not let interpreter try to evaluate the user entry (your example error message is probably related to the fact you have tried to enter something with 'dwi' and Python don't found a variable so named ;))
26th Jun 2017, 2:53 AM
visph
visph - avatar
+ 3
python v2 is different from python 3
25th Jun 2017, 8:31 PM
Hetbo.net
Hetbo.net - avatar
+ 3
you need to install python 3 on your pc
25th Jun 2017, 8:32 PM
Hetbo.net
Hetbo.net - avatar
+ 1
thanks i ll uodate my python
25th Jun 2017, 8:36 PM
Dwi Setya
Dwi Setya - avatar