Кристиан обнови решението на 08.03.2015 22:44 (преди над 9 години)
+WESTERN_SIGNS = (
+ {(1, 21): 'capricorn', (21, 32): 'aquarius'},
+ {(1, 19): 'aquarius', (19, 30): 'pisces'},
+ {(1, 21): 'pisces', (21, 32): 'aries'},
+ {(1, 21): 'aries', (21, 31): 'taurus'},
+ {(1, 21): 'taurus', (21, 32): 'gemini'},
+ {(1, 21): 'gemini', (21, 31): 'cancer'},
+ {(1, 23): 'cancer', (23, 32): 'leo'},
+ {(1, 23): 'leo', (23, 32): 'virgo'},
+ {(1, 23): 'virgo', (23, 31): 'libra'},
+ {(1, 23): 'libra', (23, 32): 'scorpio'},
+ {(1, 22): 'scorpio', (22, 31): 'sagittarius'},
+ {(1, 22): 'sagittarius', (22, 32): 'capricorn'}
+)
+
+CHINESE_SIGNS = (
+ 'monkey', 'rooster', 'dog', 'pig',
+ 'rat', 'ox', 'tiger', 'rabbit',
+ 'dragon', 'snake', 'horse', 'sheep')
+
+
+def interpret_western_sign(day, month):
+ for key in WESTERN_SIGNS[month - 1]:
+ if day in range(*key):
+ return WESTERN_SIGNS[month - 1][key]
+
+def interpret_chinese_sign(year):
+ return CHINESE_SIGNS[year % 12]
+
+def interpret_both_signs(day, month, year):
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)