Светлин обнови решението на 08.03.2015 12:09 (преди над 9 години)
+def interpret_western_sign(day, month):
+ dicts = {'aries': (3, 21, 4, 20),
+ 'taurus': (4, 21, 5, 20),
+ 'gemini': (5, 21, 6, 20),
+ 'cancer': (6, 21, 7, 22),
+ 'leo': (7, 23, 8, 22),
+ 'virgo': (8, 23, 9, 22),
+ 'libra': (9, 23, 10, 22),
+ 'scorpio': (10, 23, 11, 21),
+ 'sagittarius': (11, 22, 12, 21),
+ 'capricorn': (12, 22, 1, 20),
+ 'aquarius': (1, 21, 2, 18),
+ 'pisces': (2, 19, 3, 20)}
+ for sign, date in dicts.items():
+ if date[0] == month and date[1] <= day or date[2] == month and date[3] >= day:
+ return sign
+
+def interpret_chinese_sign(year):
+ dictc = {'rat': 1900, 'ox': 1901, 'tiger': 1902, 'rabbit':1903,
+ 'dragon': 1904, 'snake': 1905, 'horse': 1906, 'sheep': 1907,
+ 'monkey': 1908, 'rooster': 1909, 'dog': 1910, 'pig': 1911}
+ for sign, date in dictc.items():
+ if year > 1900:
+ if date == year - (((year-1900)//12)*12):
+ return sign
+ else:
+ if date == year + ((abs(year-1911)//12)*12):
+ return sign
+
+def interpret_both_signs(day, month, year):
+ a_tuple = (interpret_western_sign(day, month), interpret_chinese_sign(year))
+ return a_tuple