Людмил обнови решението на 10.03.2015 23:02 (преди над 9 години)
+western_signs = [
+ 'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo', 'libra',
+ 'scorpio', 'sagittarius', 'capricorn', 'aquarius', 'pisces'
+]
+chinese_signs = [
+ 'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger', 'rabbit',
+ 'dragon', 'snake', 'horse', 'sheep'
+]
+
+
+def interpret_western_sign(day, month):
+ if month == 1:
+ if day < 21:
+ return western_signs[9]
+ return western_signs[10]
+ if month == 2:
+ if day < 19:
+ return western_signs[10]
+ return western_signs[11]
+ if month == 3:
+ if day < 21:
+ return western_signs[11]
+ return western_signs[0]
+ if month == 4:
+ if day < 21:
+ return western_signs[0]
+ return western_signs[1]
+ if month == 5:
+ if day < 21:
+ return western_signs[1]
+ return western_signs[2]
+ if month == 6:
+ if day < 21:
+ return western_signs[2]
+ return western_signs[3]
+ if month == 7:
+ if day < 23:
+ return western_signs[3]
+ return western_signs[4]
+ if month == 8:
+ if day < 23:
+ return western_signs[4]
+ return western_signs[5]
+ if month == 9:
+ if day < 23:
+ return western_signs[5]
+ return western_signs[6]
+ if month == 10:
+ if day < 23:
+ return western_signs[6]
+ return western_signs[7]
+ if month == 11:
+ if day < 22:
+ return western_signs[7]
+ return western_signs[8]
+ if month == 12:
+ if day < 22:
+ return western_signs[8]
+ return western_signs[9]
+
+
+def interpret_chinese_sign(year):
+ return chinese_signs[abs(year % 12)]
+
+
+def interpret_both_signs(day, month, year):
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)
В момента, в който еднаквите if
-ове станаха повече от 5 не ти ли хрумна, че може би правиш нещо грешно?