Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Chapter 5, page 72 (paperback) #22

Open
ON227 opened this issue Jan 2, 2019 · 1 comment
Open

Chapter 5, page 72 (paperback) #22

ON227 opened this issue Jan 2, 2019 · 1 comment

Comments

@ON227
Copy link

ON227 commented Jan 2, 2019

When I try using this code from the book:

colors = ["purple", "orange", "green"]
guess = input("Guess a color:")
if guess in colors:
print("You guessed correctly!")
else:
print("Wrong! Try again.")

I then run the code and try guessing white to see my message for when it is wrong (although this is also happening when I guess a color that is in the list) I get the following error message:

Traceback (most recent call last):
File "", line 2, in
File "", line 1, in
NameError: name 'white' is not defined

Am I doing something wrong? I typed it in just as it is written in the book.

@calthoff
Copy link
Owner

calthoff commented Jan 2, 2019 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants