63

I'm a seventh grade programmer so I may be missing a lot of things in this program, but for my coding club my instructor asked us to make a guess the number game. I have very limited knowledge on this subject, since I've only attended four classes. Anyway, when I run this program in Python IDLE 3.5 this is what it says:

Traceback (most recent call last): File "C:\Users\morrris\AppData\Local\Programs\Python\Python35-32\guess_that_number.py", line 7, in <module> name= raw_input() NameError: name 'raw_input' is not defined 

I tried changing the code, but it seems to not like the raw_input().

3
  • 8
    Python 3.5 doesn't have raw_input. It has input() Commented Feb 3, 2016 at 4:27
  • 2
    In the future, when you post code, try to post the minimum needed to exhibit the symptom you are asking about. In this case, name= raw_input() is quite sufficient. See stackoverflow.com/help/mcve Commented Feb 3, 2016 at 14:53
  • 2
    I'm sorry, I didn't know Commented Feb 3, 2016 at 21:53

1 Answer 1

122

For Python 3.x, use input(). For Python 2.x, use raw_input(). Don't forget you can add a prompt string in your input() call to create one less print statement. input("GUESS THAT NUMBER!").

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.