Йоан обнови решението на 07.03.2015 15:02 (преди над 9 години)
+def interpret_chinese_sign(year):
+ chinese_type = year % 12
+
+ chinese_signs = ('rat', 'ox', 'tiger', 'rabbit', 'dragon', 'snake', 'horse', 'sheep', 'monkey', 'rooster', 'dog', 'pig')
+
+ return chinese_signs[chinese_type - 4]
+
+def interpret_western_sign(day, month):
+ zodiac_signs = ['capricorn', 'aquaris', 'pisces', 'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo', 'libra', 'scorpio', 'sagittarius']
+
+ if month in [1, 3, 4, 5, 6, 7]:
+ next_month_date = 21
+ elif month == 2:
+ next_month_date = 19
+ elif month in [8, 9, 10, 11]:
+ next_month_date = 23
+ else:
+ next_month_date = 22
+
+ if day >= next_month_date and month == 12:
+ month = 1
+ elif day >= next_month_date:
+ return zodiac_signs[month]
+
+ return zodiac_signs[month - 1]
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))