Цветан обнови решението на 09.03.2015 19:44 (преди над 9 години)
+chinese_sign = ['monkey', 'rooster', 'dog', 'pig', 'rat', 'ox',
+ 'tiger', 'rabbit', 'dragon', 'snake', 'horse', 'sheep']
+
+zodiac_sign = {
+ 'aries': list(range(321, 331)) + list(range(401, 420)),
+ 'taurus': list(range(421, 430)) + list(range(501, 520)),
+ 'gemini': list(range(521, 531)) + list(range(601, 620)),
+ 'cancer': list(range(621, 630)) + list(range(701, 722)),
+ 'leo': list(range(723, 731)) + list(range(801, 822)),
+ 'virgo': list(range(823, 831)) + list(range(901, 922)),
+ 'libra': list(range(932, 930)) + list(range(1001, 1022)),
+ 'scorpio': list(range(1023, 1031)) + list(range(1101, 1121)),
+ 'sagittarius': list(range(1122, 1130)) + list(range(1201, 1221)),
+ 'capricorn': list(range(1222, 1231)) + list(range(101, 120)),
+ 'aquarius': list(range(121, 131)) + list(range(201, 218)),
+ 'pisces': list(range(219, 229)) + list(range(301, 320))
+}
+
+
+def interpret_chinese_sign(year):
+ if year >= 0:
+ return chinese_sign[year % 12]
+ else:
+ return chinese_sign[12 - year % 12]
+
+
+def interpret_western_sign(day, month):
+ for key, value in zodiac_sign.items():
+ if (day + 100 * month) in value:
+ return key
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))