Марина обнови решението на 08.03.2015 19:29 (преди над 9 години)
+western_signs = [
+ (20, ['capricorn', 'aquarius']),
+ (18, ['aquarius', 'pisces']),
+ (20, ['pisces', 'aries']),
+ (20, ['aries', 'taurus']),
+ (20, ['taurus', 'gemini']),
+ (20, ['gemini', 'cancer'] ),
+ (22, ['cancer', 'leo']),
+ (22, ['leo', 'virgo']),
+ (22, ['virgo', 'libra']),
+ (22, ['libra', 'scorpio']),
+ (21, ['scorpio', 'sagittarius']),
+ (21, ['sagittarius', 'capricorn'])
+]
+
+chinese_signs = {
+ 'rat': 1900,
+ 'ox': 1901,
+ 'tiger': 1902,
+ 'rabbit': 1903,
+ 'dragon': 1904,
+ 'snake': 1905,
+ 'horse': 1906,
+ 'sheep': 1907,
+ 'monkey': 1908,
+ 'rooster': 1909,
+ 'dog': 1910,
+ 'pig': 1911
+}
+
+def interpret_western_sign(day, month):
+ get_month = western_signs[month-1]
+ date = get_month[0]
+ if day <= date:
+ return get_month[1][0]
+ else:
+ return get_month[1][1]
+
+def interpret_chinese_sign(year):
+ for key in chinese_signs:
+ diff = year - chinese_signs[key]
+ if diff % 12 == 0:
+ return key
+
+def interpret_both_signs(day, month, year):
+ western = interpret_western_sign(day, month)
+ chinese = interpret_chinese_sign(year)
+ return (western, chinese)