Любослава обнови решението на 08.03.2015 14:55 (преди над 9 години)
+def interpret_western_sign(day, month):
+ months = {
+ 1: [range(1, 21), "capricorn", "aquarius"],
+ 2: [range(1, 19), "aquarius", "pisces"],
+ 3: [range(1, 21), "pisces", "aries"],
+ 4: [range(1, 21), "aries", "taurus"],
+ 5: [range(1, 21), "taurus", "gemini"],
+ 6: [range(1, 21), "gemini", "cancer"],
+ 7: [range(1, 23), "cancer", "leo"],
+ 8: [range(1, 23), "leo", "virgo"],
+ 9: [range(1, 23), "virgo", "libra"],
+ 10: [range(1, 23), "libra", "scorpio"],
+ 11: [range(1, 22), "scorpio", "sagittarius"],
+ 12: [range(1, 22), "sagittarius", "capricorn"]
+ }
+
+ if day in months[month][0]:
+ return months[month][1]
+ else:
+ return months[month][2]
+
+
+def interpret_chinese_sign(year):
+ chinese = [(1900, "rat"), (1901, "ox"), (1902, "tiger"), (1903, "rabbit"),
+ (1904, "dragon"), (1905, "snake"), (1906, "horse"),
+ (1907, "sheep"), (1908, "monkey"), (1909, "rooster"),
+ (1910, "dog"), (1911, "pig")]
+ index = (year - chinese[0][0]) % 12
+ return chinese[index][1]
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))