Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Paul Bentham24,090 Points
Name_Error on Switching it Up? 'a' is not defined... using terminal on Ubuntu.
When I run diary.py in terminal on Ubuntu I get a Name_Error when I type a or v. If I put them inside quotes I don't get the error?
I tried to get around this by putting str() around the input() but that didnt work.
Here is the terminal output:
office@Office-PC:~/Desktop/Database example$ python diary.py Enter 'q' to quit. a Add an entry v View previous entries Action: a Traceback (most recent call last): File "diary.py", line 51, in <module> menu_loop() File "diary.py", line 30, in menu_loop choice = str(input('Action: ').lower().strip()) File "<string>", line 1, in <module> NameError: name 'a' is not defined office@Office-PC:~/Desktop/Database example$
Kenneth LoveTreehouse Guest Teacher
Guessing you're on Python 2.7 instead of 3.4 like we use for everything at Treehouse. You'll need to use
raw_input() instead of