Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please help me how i can turn this into a list... so i far i have this year_msg = int(input(What is the year that you

Please help me how i can turn this into a list... so i far i have this

year_msg = int(input("What is the year that you want to convert? "))

year_formula = (year_msg + 9) % 12

if year_formula == 1: print("This is the year of the Rat.") elif year_formula == 2: print("This is the year of the Ox.") elif year_formula == 3: print("This is the year of the Tiger.") elif year_formula == 4: print("This is the year of the Rabbit.") elif year_formula == 5: print("This is the year of the Dragon.") elif year_formula == 6: print("This is the year of the Snake.") elif year_formula == 7: print("This is the year of the Horse.") elif year_formula == 8: print("This is the year of the Goat.") elif year_formula == 9: print("This is the year of the Monkey.") elif year_formula == 10: print("This is the year of the Rooster.") elif year_formula == 11: print("This is the year of the Dog.") else: year_formula == 12 print("This is the year of the Pig.")

and this pretty much tells you the years chinese zodiac sign but i am having trouble making this into a list and say the same exact thing like this

and I cannot have "if" statements in this code where i got stuck and cannot figure out how to do this with for loops, this is what the instuction is

image text in transcribed

Remember that the years in order are: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig Put these into a list, and then access the proper element via a list rather than a lot of if statements. The only if statement in your code should be the if_name__ == '_main__': linux [0] $ python3 What is the year that you want to convert? 3022 Horse linux [0] $ python3..... What is the year that you want to convert? 2081 Ox linux [0] $ python3 ---3.py What is the year that you want to convert? 1847 Goat

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions