Python does not support switch case direct but you can
implement it by using else-if as in following manner
print "Enter day of the week number>> "
a=int(raw_input())
if(a==1):
print("Mon")
elif(a==2):
print("Tue")
elif(a==3):
print("Wed")
elif(a==4):
print("Thu")
elif(a==5):
print("Fri")
elif(a==6):
print("Stu")
elif(a==7):
print("Sun");
else:
print("Invalid Choice")
No comments:
Post a Comment