Деян обнови решението на 07.03.2015 22:19 (преди над 9 години)
+chineese_signs_by_year = ["monkey", "rooster", "dog", "pig", "rat", "ox", "tiger", "rabbit", "dragon", "snake", "horse", "sheep"]
+def interpret_chinese_sign(year):
+ chineese_sign = chineese_signs_by_year[year % 12]
+ return chineese_sign
+
+western_signs_by_month = {
+ 1 : { (1, 20) : "capricorn", (21, 31) : "aquarius" },
+ 2 : { (1, 18) : "aquarius", (19, 29) : "pisces" },
+ 3 : { (1, 20) : "pisces ", (21, 31) : "aries" },
+ 4 : { (1, 20) : "aries", (21, 30) : "taurus" },
+ 5 : { (1, 20) : "taurus", (21, 31) : "gemini" },
+ 6 : { (1, 20) : "gemini", (21, 30) : "cancer" },
+ 7 : { (1, 22) : "cancer", (23, 31) : "leo" },
+ 8 : { (1, 22) : "leo", (23, 31) : "virgo" },
+ 9 : { (1, 22) : "virgo", (23, 30) : "libra" },
+ 10 : { (1, 22) : "libra", (23, 31) : "scorpio" },
+ 11 : { (1, 21) : "scorpio", (22, 30) : "sagittarius" },
+ 12 : { (1, 21) : "sagittarius", (22, 31) : "capricorn" }
+}
+
+def interpret_western_sign(day, month):
+ ranges_for_month = western_signs_by_month[month]
+ for key in ranges_for_month.keys():
+ if day >= key[0] and day <= key[1]:
+ western_sign = ranges_for_month[key]
+ return western_sign
+
+
+def interpret_both_signs(day, month, year):
+ western_sign = interpret_western_sign(day, month)
+ chineese_sign = interpret_chinese_sign(year)
+ western_chineese_sign_pair = (western_sign, chineese_sign)
+ return western_chineese_sign_pair