Минх обнови решението на 06.03.2015 21:34 (преди над 9 години)
+SIGN_BOUNDARY = {
+ '1': 21,
+ '2': 19,
+ '3': 21,
+ '4': 21,
+ '5': 21,
+ '6': 21,
+ '7': 23,
+ '8': 23,
+ '9': 23,
+ '10': 23,
+ '11': 22,
+ '12': 22
+}
+
+SIGN_MONTHS = {
+ '1': 'aquarius',
+ '2': 'pisces',
+ '3': 'aries',
+ '4': 'taurus',
+ '5': 'gemini',
+ '6': 'cancer',
+ '7': 'leo',
+ '8': 'virgo',
+ '9': 'libra',
+ '10': 'scorpio',
+ '11': 'sagittarius',
+ '12': 'capricorn'
+}
+
+CHINESE_SIGNS = {
+ '0': 'rat',
+ '1': 'ox',
+ '2': 'tiger',
+ '3': 'rabbit',
+ '4': 'dragon',
+ '5': 'snake',
+ '6': 'horse',
+ '7': 'sheep',
+ '8': 'monkey',
+ '9': 'rooster',
+ '10': 'dog',
+ '11': 'pig'
+}
+
+
+def interpret_western_sign(day, month):
+ if day < SIGN_BOUNDARY[str(month)]:
+ if month - 1 > 0:
+ return SIGN_MONTHS[str(month-1)]
+ else:
+ return SIGN_MONTHS[str(12)]
+ return SIGN_MONTHS[str(month)]
+
+
+def interpret_chinese_sign(year):
+ return CHINESE_SIGNS[str((year - 1900) % 12)]
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))