Кристиян обнови решението на 10.03.2015 02:22 (преди над 9 години)
+def interpret_chinese_sign(year):
+ zodiac = (year - 4) % 12
+ if zodiac is 0:
+ return "rat"
+ if zodiac is 1:
+ return "ox"
+ if zodiac is 2:
+ return "tiger"
+ if zodiac is 3:
+ return "rabbit"
+ if zodiac is 4:
+ return "dragon"
+ if zodiac is 5:
+ return "snake"
+ if zodiac is 6:
+ return "horse"
+ if zodiac is 7:
+ return "sheep"
+ if zodiac is 8:
+ return "monkey"
+ if zodiac is 9:
+ return "rooster"
+ if zodiac is 10:
+ return "dog"
+ if zodiac is 11:
+ return "pig"
+
+
+def interpret_western_sign(day, month):
+ if day >= 21 and month is 3 or day <= 20 and month is 4:
+ return "aries"
+ if day >= 21 and month is 4 or day <= 20 and month is 5:
+ return "taurus"
+ if day >= 21 and month is 5 or day <= 20 and month is 6:
+ return "gemini"
+ if day >= 21 and month is 6 or day <= 22 and month is 7:
+ return "cancer"
+ if day >= 23 and month is 7 or day <= 22 and month is 8:
+ return "leo"
+ if day >= 23 and month is 8 or day <= 22 and month is 9:
+ return "virgo"
+ if day >= 23 and month is 9 or day <= 22 and month is 10:
+ return "libra"
+ if day >= 23 and month is 10 or day <= 21 and month is 11:
+ return "scorpio"
+ if day >= 22 and month is 11 or day <= 21 and month is 12:
+ return "sagittarius"
+ if day >= 22 and month is 12 or day <= 20 and month is 1:
+ return "capricorn"
+ if day >= 21 and month is 1 or day <= 18 and month is 2:
+ return "aquarius"
+ if day >= 19 and month is 2 or day <= 20 and month is 3:
+ return "pisces"
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))
The number of if
is too damn high. Пробвай се да измислиш нещо разумно. Организрай си данните в някакъв вид структура може би.