Решение на Астрологични забави от Данаил Димитров

Обратно към всички решения

Към профила на Данаил Димитров

Резултати

  • 10 точки от тестове
  • 0 бонус точки
  • 10 точки общо
  • 6 успешни тест(а)
  • 0 неуспешни тест(а)

Код

SIGNS = (
'aries',
'taurus',
'gemini',
'cancer',
'leo',
'virgo',
'libra',
'scorpio',
'sagittarius1',
'capricorn',
'aquarius',
'pisces'
)
SIGNS_FOR_MONTS = dict([(1, [21, [SIGNS[9], SIGNS[10]]]),
(2, [19, [SIGNS[10], SIGNS[11]]]),
(3, [21, [SIGNS[11], SIGNS[0]]]),
(4, [21, [SIGNS[0], SIGNS[1]]]),
(5, [21, [SIGNS[1], SIGNS[2]]]),
(6, [21, [SIGNS[2], SIGNS[3]]]),
(7, [23, [SIGNS[3], SIGNS[4]]]),
(8, [23, [SIGNS[4], SIGNS[5]]]),
(9, [23, [SIGNS[5], SIGNS[6]]]),
(10, [23, [SIGNS[6], SIGNS[7]]]),
(11, [22, [SIGNS[7], SIGNS[8]]]),
(12, [22, [SIGNS[8], SIGNS[9]]])])
def interpret_western_sign(day, month):
possibleSigns = SIGNS_FOR_MONTS[month][1]
singLastDay = SIGNS_FOR_MONTS[month][0]
if day > singLastDay:
res = possibleSigns[1]
else:
res = possibleSigns[0]
return res
START_YEAR = 1900
CH_SIGNS = ('rat', 'ox', 'tiger', 'rabbit',
'dragon', 'snake', 'horse', 'sheep',
'monkey', 'rooster', 'dog', 'pig')
def interpret_chinese_sign(year):
return CH_SIGNS[(year - START_YEAR) % 12]
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day, month), interpret_chinese_sign(year))

Лог от изпълнението

......
----------------------------------------------------------------------
Ran 6 tests in 0.006s

OK

История (2 версии и 0 коментара)

Данаил обнови решението на 07.03.2015 21:50 (преди над 9 години)

+SIGNS = (
+ 'aries',
+ 'taurus',
+ 'gemini',
+ 'cancer',
+ 'leo',
+ 'virgo',
+ 'libra',
+ 'scorpio',
+ 'sagittarius1',
+ 'capricorn',
+ 'aquarius',
+ 'pisces'
+)
+
+SIGNS_FOR_MONTS = dict([(1, [21, [SIGNS[9], SIGNS[10]]]),
+ (2, [19, [SIGNS[10], SIGNS[11]]]),
+ (3, [21, [SIGNS[11], SIGNS[0]]]),
+ (4, [21, [SIGNS[0], SIGNS[1]]]),
+ (5, [21, [SIGNS[1], SIGNS[2]]]),
+ (6, [21, [SIGNS[2], SIGNS[3]]]),
+ (7, [23, [SIGNS[3], SIGNS[4]]]),
+ (8, [23, [SIGNS[4], SIGNS[5]]]),
+ (9, [23, [SIGNS[5], SIGNS[6]]]),
+ (10, [23, [SIGNS[6], SIGNS[7]]]),
+ (11, [22, [SIGNS[7], SIGNS[8]]]),
+ (12, [22, [SIGNS[8], SIGNS[9]]])])
+
+
+def interpret_western_sign(day, month):
+ possibleSigns = SIGNS_FOR_MONTS[month][1]
+ singLastDay = SIGNS_FOR_MONTS[month][0]
+
+ if day > singLastDay:
+ res = possibleSigns[1]
+ else:
+ res = possibleSigns[0]
+ return res
+
+
+START_YEAR = 1900
+CH_SIGNS = ('rat', 'ox', 'tiger', 'rabbit',
+ 'dragon', 'snake', 'horse', 'sheep',
+ 'monkey', 'rooster', 'dog', 'pig')
+
+
+def interpret_chinese_sign(year):
+ return CH_SIGNS[(year - START_YEAR) % 12]

Данаил обнови решението на 07.03.2015 21:56 (преди над 9 години)

SIGNS = (
'aries',
'taurus',
'gemini',
'cancer',
'leo',
'virgo',
'libra',
'scorpio',
'sagittarius1',
'capricorn',
'aquarius',
'pisces'
)
SIGNS_FOR_MONTS = dict([(1, [21, [SIGNS[9], SIGNS[10]]]),
(2, [19, [SIGNS[10], SIGNS[11]]]),
(3, [21, [SIGNS[11], SIGNS[0]]]),
(4, [21, [SIGNS[0], SIGNS[1]]]),
(5, [21, [SIGNS[1], SIGNS[2]]]),
(6, [21, [SIGNS[2], SIGNS[3]]]),
(7, [23, [SIGNS[3], SIGNS[4]]]),
(8, [23, [SIGNS[4], SIGNS[5]]]),
(9, [23, [SIGNS[5], SIGNS[6]]]),
(10, [23, [SIGNS[6], SIGNS[7]]]),
(11, [22, [SIGNS[7], SIGNS[8]]]),
(12, [22, [SIGNS[8], SIGNS[9]]])])
def interpret_western_sign(day, month):
possibleSigns = SIGNS_FOR_MONTS[month][1]
singLastDay = SIGNS_FOR_MONTS[month][0]
if day > singLastDay:
res = possibleSigns[1]
else:
res = possibleSigns[0]
return res
START_YEAR = 1900
CH_SIGNS = ('rat', 'ox', 'tiger', 'rabbit',
'dragon', 'snake', 'horse', 'sheep',
'monkey', 'rooster', 'dog', 'pig')
def interpret_chinese_sign(year):
return CH_SIGNS[(year - START_YEAR) % 12]
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))