Елица обнови решението на 09.03.2015 23:29 (преди над 9 години)
+def interpret_western_sign(day, month):
+ signs = [
+ ('capricorn', 'aquarius', 20),
+ ('aquarius', 'pisces', 18),
+ ('pisces', 'aries', 20),
+ ('aries', 'taurus', 20),
+ ('taurus', 'gemini', 20),
+ ('gemini', 'cancer', 20),
+ ('cancer', 'leo', 22),
+ ('leo', 'virgo', 22),
+ ('virgo', 'libra', 22),
+ ('libra', 'scorpio', 22),
+ ('scorpio', 'sagittarius', 21),
+ ('sagittarius', 'capricorn', 21)
+ ]
+
+ possibleSigns = signs[month - 1]
+ dayOfTheChange = possibleSigns[2]
+ if day > dayOfTheChange:
+ return possibleSigns[1]
+ else:
+ return possibleSigns[0]
+
+
+def interpret_chinese_sign(year):
+ signs = {
+ (1900 % 12): 'rat',
+ (1901 % 12): 'ox',
+ (1902 % 12): 'tiger',
+ (1903 % 12): 'rabbit',
+ (1904 % 12): 'dragon',
+ (1905 % 12): 'snake',
+ (1906 % 12): 'horse',
+ (1907 % 12): 'sheep',
+ (1908 % 12): 'monkey',
+ (1909 % 12): 'rooster',
+ (1910 % 12): 'dog',
+ (1911 % 12): 'pig'
+ }
+ return signs[year % 12]
+
+
+def interpret_both_signs(day, month, year):
+ chineseSign = interpret_chinese_sign(year)
+ westernSign = interpret_western_sign(day, month)
+ signTuple = (westernSign, chineseSign)
+ return signTuple