diff --git a/problem_set/Q2_Chinese_Zodiac.py b/problem_set/Q2_Chinese_Zodiac.py index 010f431..e0afc50 100644 --- a/problem_set/Q2_Chinese_Zodiac.py +++ b/problem_set/Q2_Chinese_Zodiac.py @@ -10,4 +10,31 @@ # write a function that takes the year as the input and produces the Zodiac for that year # output should be in the format "2000 is the year of the Fire Rat" +chinese_dict= { + 'animals': ["Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"], + 'elements': ["Fire", "Earth", "Metal", "Water", "Wood"] +} +year=2000 +def chinese_new_year(x): + """ + Takes a inputted year, and output what Chinese Zodiac is for that year + """ + x = int(x) + # Initialized for 2024 and cycles through the total 60 states the Zodiac may be. + ## It is aligned with the index numbers of the list + year = (x-2024) % 60 + result=[] + for element in chinese_dict["elements"]: + for animal in chinese_dict["animals"]: + order = f"{element} {animal}" + result.append(order) + Zodiac = result[year] + if x<2024: + Messege = f"{x} was the year of the {Zodiac}" + else: + Messege = f"{x} is the year of the {Zodiac}" + return Messege + +Zodiac = chinese_new_year(input("Input a year to determine it's associated Zodiac: ")) +print(Zodiac) \ No newline at end of file