Гюлджан обнови решението на 06.03.2015 15:14 (преди над 9 години)
+def interpret_western_sign(day, month):
+ if month == 3 and day >= 21 or month == 4 and day <= 20:
+ return "aries"
+ elif month == 4 and day >= 21 or month == 5 and day <= 20:
+ return "taurus"
+ elif month == 5 and day >= 21 or month == 6 and day <= 20:
+ return "gemini"
+ elif month == 6 and day >= 21 or month == 7 and day <= 22:
+ return "cancer"
+ elif month == 7 and day >= 23 or month == 8 and day <= 22:
+ return "leo"
+ elif month == 8 and day >= 23 or month == 9 and day <= 22:
+ return "virgo"
+ elif month == 9 and day >= 23 or month == 10 and day <= 22:
+ return "libra"
+ elif month == 10 and day >= 23 or month == 11 and day <= 21:
+ return "scorpio"
+ elif month == 11 and day >= 22 or month == 12 and day <= 21:
+ return "sagittarius"
+ elif month == 12 and day >= 22 or month == 1 and day <= 20:
+ return "capricorn"
+ elif month == 1 and day >= 21 or month == 2 and day <= 18:
+ return "aquarius"
+ elif month == 2 and day >= 19 or month == 3 and day <= 20:
+ return "pisces"
+
+
+def interpret_chinese_sign(year):
+ remainder = (year - 1900) % 12
+ if remainder == 0:
+ return "rat"
+ elif remainder == 1:
+ return "ox"
+ elif remainder == 2:
+ return "tiger"
+ elif remainder == 3:
+ return "rabbit"
+ elif remainder == 4:
+ return "dragon"
+ elif remainder == 5:
+ return "snake"
+ elif remainder == 6:
+ return "horse"
+ elif remainder == 7:
+ return "sheep"
+ elif remainder == 8:
+ return "monkey"
+ elif remainder == 9:
+ return "rooster"
+ elif remainder == 10:
+ return "dog"
+ elif remainder == 11:
+ return "pig"
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))
Генерализирай малко, де. Ако зодиите бяха 6498 толкова if-а ли щеше да сложиш?