Question
(a.) How many elif statements are used in the Chinese Zodiac program and (b.) why is the last statement in this program an else statement?
(a.) How many elif statements are used in the Chinese Zodiac program and (b.) why is the last statement in this program an else statement?
year = eval(input("Enter a year: ")) zodiacYear = year % 12 if zodiacYear == 0: print("monkey") elif zodiacYear == 1: print("rooster") elif zodiacYear == 2: print("dog") elif zodiacYear == 3: print("pig") elif zodiacYear == 4: print("rat") elif zodiacYear == 5: print("ox") elif zodiacYear == 6: print("tiger") elif zodiacYear == 7: print("rabbit") elif zodiacYear == 8: print("dragon") elif zodiacYear == 9: print("snake") elif zodiacYear == 10: print("horse") else: print("sheep")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started