Thread: if elif else
View Single Post
Old Feb 13th, 2005, 11:55 AM   #1
arod199113
Programmer
 
arod199113's Avatar
 
Join Date: Feb 2005
Posts: 86
Rep Power: 0 arod199113 is an unknown quantity at this point
Question if elif else

say i had a program like this:

a = raw_input("Type either ball, cat, dog, or eat:")
if a == "ball":
     print "abcd"
elif a == "cat":
     print "abcd"
elif a == "dog":
     print "wxyz"
elif a == "eat":
     print "wxyz"


basically if you were type ball or cat it would print abcd
and if you were to type dog or eat it would print wxyz
is it possible to not have to repeat typing: print "abcd" 2 times
like:
if a = "ball" or "cat":
print "abcd"
i know its not done like that i just wanna know if it can be done somehow

Last edited by arod199113; Feb 13th, 2005 at 11:58 AM.
arod199113 is offline   Reply With Quote