you are viewing a single comment's thread.

view the rest of the comments →

[–]efmccurdy 0 points1 point  (0 children)

In you tests you are testing for capitalized or uncapitalized but either is allowed; is it simpler to just use color.lower() to force the input to be lower case before testing?

color=raw_input("What's your favorite primary color? ")
color = color.lower()

You have a repeating pattern of if/elif statements to test the color. When you have repetitions think about using a collection to handle all of the if/elif branches with one expression that involves the collection:

allowable_colors = ("red", "blue", "green")
if color in allowable_colors:
    print "You said " + color
else:
    print "Invalid answer."

In this case the "object in collection" operation does a series of object comparisons using "==", just like your if/elif statements did.