Question: Requirements: Given a poorly written Python script, poor _ chinese _ zodiac.py , that determines the Chinese Zodiac sign for a year input by the

Requirements:
Given a poorly written Python script, poor_chinese_zodiac.py, that determines the
Chinese Zodiac sign for a year input by the user, write a well-structured Python script,
chinese_zodiac.py, that uses functions and a list to get the same result.
The Chinese Zodiac is based on a 12-year cycle, with each year represented by an animal -
monkey, rooster, dog, pig, rat, ox, tiger, rabbit, dragon, snake, horse, and sheep.
Note that year %12 determines the Zodiac sign. For example, 1900 is the year of the rat
because 1900%12=4.
Below is the code for poor_chinese_zodiac.py.
Your job is to restructure the code. Here are the requirements for restructuring:
There should be a main function, a get_input function, and a
get_zodiac_animal function.
The main function should get the user's input, year, from get_input.
The main function should send year to get_zodiac_animal.
The get_zodiac_animal function should return to main the name of the
appropriate animal.
Use a list of animals in the get_zodiac_animal function.
signs =['monkey', 'rooster', 'dog', 'pig',
'rat', 'ox', 'tiger', 'rabbit',
'dragon', 'snake', 'horse', 'sheep']
You can determine which element of signs you want by calculating the index as
animal_year = year %12.
SampleOutput:
 Requirements: Given a poorly written Python script, poor_chinese_zodiac.py, that determines the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!