Мартин обнови решението на 10.03.2015 23:26 (преди над 9 години)
+def interpret_western_sign(day, month):
+
+ signs = [("capricorn", "aquarius", 21), ("aquarius", "pisces", 19),
+ ("pisces", "aries", 21), ("aries", "taurus", 21),
+ ("taurus", "gemini", 21), ("gemini", "cancer", 21),
+ ("cancer", "leo", 23), ("leo", "virgo", 23),
+ ("virgo", "libra", 23), ("libra", "scorpio", 23),
+ ("scorpio", "sagittarius", 22), ("sagittarius", "capricorn", 22)]
+
+ for current in range(0, len(signs)):
+ if month == current + 1:
+ if day >= signs[current][2]:
+ return signs[current][1]
+ else:
+ return signs[current][0]
+
+
+def interpret_chinese_sign(year):
+
+ signs = ["rat", "ox", "tiger", "rabbit", "dragon", "snake",
+ "horse", "sheep", "monkey", "rooster", "dog", "pig"]
+
+ REFERENCE_YEAR = 1900
+ modular_year = year - REFERENCE_YEAR
+ modular_year %= len(signs)
+
+ for current in range(0, len(signs)):
+ if modular_year == current:
+ return signs[current]
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))