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