Николай обнови решението на 08.03.2015 22:14 (преди над 9 години)
+def interpret_western_sign(day, month):
+ zodiacs = [("0120", "capricorn"), ("0218", "aquarius"), ("0320", "pisces"),
+ ("0420", "aries"), ("0521", "taurus"), ("0621", "gemini"),
+ ("0722", "cancer"), ("0823", "leo"), ("0923", "virgo"),
+ ("1023", "libra"), ("1122", "scorpio"), ("1222", "sagittarius"),
+ ("1231", "capricorn")]
+ code = "{:02d}{:02d}".format(month, day)
+
+ for zodiac in zodiacs:
+ if code <= zodiac[0]:
+ return zodiac[1]
+
+
+def interpret_chinese_sign(year):
+ zodiacs = {0: "rat", 1: "ox", 2: "tiger", 3: "rabit",
+ 4: "dragon", 5: "snake", 6: "horse", 7: "sheep",
+ 8: "monkey", 9: "rooster", 10: "dog", 11: "pig"}
+ year = (year - 1900) % 12
+ return zodiacs[year]
+
+
+def interpret_both_signs(day, month, year):
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)