Явор обнови решението на 06.03.2015 00:32 (преди над 9 години)
+import datetime
+
+
+def interpret_western_sign(day, month):
+
+ zodiacal_signs_data = [
+ {
+ 'sign_name': 'aquarius',
+ 'start_date': datetime.date(2015, 1, 21),
+ 'end_date': datetime.date(2015, 2, 19),
+ },
+ {
+ 'sign_name': 'pisces',
+ 'start_date': datetime.date(2015, 2, 19),
+ 'end_date': datetime.date(2015, 3, 20),
+ },
+ {
+ 'sign_name': 'capricorn',
+ 'start_date': datetime.date(2015, 12, 22),
+ 'end_date': datetime.date(2016, 1, 20),
+ },
+ {
+ 'sign_name': 'sagittarius',
+ 'start_date': datetime.date(2015, 11, 22),
+ 'end_date': datetime.date(2015, 12, 21),
+ },
+ {
+ 'sign_name': 'scorpio',
+ 'start_date': datetime.date(2015, 10, 23),
+ 'end_date': datetime.date(2015, 11, 21),
+ },
+ {
+ 'sign_name': 'libra',
+ 'start_date': datetime.date(2015, 9, 23),
+ 'end_date': datetime.date(2015, 10, 22),
+ },
+ {
+ 'sign_name': 'virgo',
+ 'start_date': datetime.date(2015, 8, 23),
+ 'end_date': datetime.date(2015, 9, 22),
+ },
+ {
+ 'sign_name': 'leo',
+ 'start_date': datetime.date(2015, 7, 23),
+ 'end_date': datetime.date(2015, 8, 22),
+ },
+ {
+ 'sign_name': 'cancer',
+ 'start_date': datetime.date(2015, 6, 21),
+ 'end_date': datetime.date(2015, 7, 22),
+ },
+ {
+ 'sign_name': 'gemini',
+ 'start_date': datetime.date(2015, 5, 21),
+ 'end_date': datetime.date(2015, 6, 20),
+ },
+ {
+ 'sign_name': 'aries',
+ 'start_date': datetime.date(2015, 3, 21),
+ 'end_date': datetime.date(2015, 4, 20),
+ },
+ {
+ 'sign_name': 'taurus',
+ 'start_date': datetime.date(2015, 4, 21),
+ 'end_date': datetime.date(2015, 5, 20),
+ },
+ ]
+
+ target_date = datetime.date(2015, month, day)
+
+ for sign in zodiacal_signs_data:
+ if sign['start_date'] <= target_date <= sign['end_date']:
+ return sign['sign_name']
+
+
+def interpret_chinese_sign(year):
+
+ chinese_zodiac_signs = [
+ 'monkey', 'rooster', 'dog', 'pig',
+ 'rat', 'ox', 'tiger', 'rabbit', 'dragon',
+ 'snake', 'horse', 'sheep',
+ ]
+
+ return chinese_zodiac_signs[year % 12]
+
+
+def interpret_both_signs(day, month, year):
+ return(interpret_western_sign(day, month), interpret_chinese_sign(year))