Spaghetti monster problem fail


#1
god = raw_input("Do you believe in God?")
belief = raw_input("Do you believe in the Spaghetti monster?")
def the_flying_circus():
    if god == ("Yes" or "True" or "Y" or "y"):    
     print "God protects you from the evils of the world"
         elif belief == ("Yes" or "True" or "Y" or "y"):
        print "The spaghetti monster protects you with his tomato goodness"
            else:
      print "The Spaghetti monster attacks!!!!"

When I run it it seems to crash no matter what you answer after taking input. Any chance anyone could help?

Cheers

T


#2

is this part of an exercise? If so, i think i know which exercise it is, this exercise doesn’t allow the use of raw_input, well, it does allow, but then the validation crashes. So, don’t use raw_input

also, this:

if god == ("Yes" or "True" or "Y" or "y"):  

won’t work. You have to do:

if god == "Yes" or god == "True":

and so on. What you did there is a mistake many people make in the beginning

you could create a list and use in to make this more efficient, which would look like this:

if god in ['Yes', 'True']:

#3

Thanks for the help :smiley:


#4

My husband and I LOLd at this. :laughing:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.