Решение на Астрологични забави от Кристиян Бъновски

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

Към профила на Кристиян Бъновски

Резултати

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

Код

def interpret_chinese_sign(year):
zodiac = (year - 4) % 12
if zodiac is 0:
return "rat"
if zodiac is 1:
return "ox"
if zodiac is 2:
return "tiger"
if zodiac is 3:
return "rabbit"
if zodiac is 4:
return "dragon"
if zodiac is 5:
return "snake"
if zodiac is 6:
return "horse"
if zodiac is 7:
return "sheep"
if zodiac is 8:
return "monkey"
if zodiac is 9:
return "rooster"
if zodiac is 10:
return "dog"
if zodiac is 11:
return "pig"
def interpret_western_sign(day, month):
if day >= 21 and month is 3 or day <= 20 and month is 4:
return "aries"
if day >= 21 and month is 4 or day <= 20 and month is 5:
return "taurus"
if day >= 21 and month is 5 or day <= 20 and month is 6:
return "gemini"
if day >= 21 and month is 6 or day <= 22 and month is 7:
return "cancer"
if day >= 23 and month is 7 or day <= 22 and month is 8:
return "leo"
if day >= 23 and month is 8 or day <= 22 and month is 9:
return "virgo"
if day >= 23 and month is 9 or day <= 22 and month is 10:
return "libra"
if day >= 23 and month is 10 or day <= 21 and month is 11:
return "scorpio"
if day >= 22 and month is 11 or day <= 21 and month is 12:
return "sagittarius"
if day >= 22 and month is 12 or day <= 20 and month is 1:
return "capricorn"
if day >= 21 and month is 1 or day <= 18 and month is 2:
return "aquarius"
if day >= 19 and month is 2 or day <= 20 and month is 3:
return "pisces"
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day, month), interpret_chinese_sign(year))

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

......
----------------------------------------------------------------------
Ran 6 tests in 0.007s

OK

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

Кристиян обнови решението на 10.03.2015 02:22 (преди над 9 години)

+def interpret_chinese_sign(year):
+ zodiac = (year - 4) % 12
+ if zodiac is 0:
+ return "rat"
+ if zodiac is 1:
+ return "ox"
+ if zodiac is 2:
+ return "tiger"
+ if zodiac is 3:
+ return "rabbit"
+ if zodiac is 4:
+ return "dragon"
+ if zodiac is 5:
+ return "snake"
+ if zodiac is 6:
+ return "horse"
+ if zodiac is 7:
+ return "sheep"
+ if zodiac is 8:
+ return "monkey"
+ if zodiac is 9:
+ return "rooster"
+ if zodiac is 10:
+ return "dog"
+ if zodiac is 11:
+ return "pig"
+
+
+def interpret_western_sign(day, month):
+ if day >= 21 and month is 3 or day <= 20 and month is 4:
+ return "aries"
+ if day >= 21 and month is 4 or day <= 20 and month is 5:
+ return "taurus"
+ if day >= 21 and month is 5 or day <= 20 and month is 6:
+ return "gemini"
+ if day >= 21 and month is 6 or day <= 22 and month is 7:
+ return "cancer"
+ if day >= 23 and month is 7 or day <= 22 and month is 8:
+ return "leo"
+ if day >= 23 and month is 8 or day <= 22 and month is 9:
+ return "virgo"
+ if day >= 23 and month is 9 or day <= 22 and month is 10:
+ return "libra"
+ if day >= 23 and month is 10 or day <= 21 and month is 11:
+ return "scorpio"
+ if day >= 22 and month is 11 or day <= 21 and month is 12:
+ return "sagittarius"
+ if day >= 22 and month is 12 or day <= 20 and month is 1:
+ return "capricorn"
+ if day >= 21 and month is 1 or day <= 18 and month is 2:
+ return "aquarius"
+ if day >= 19 and month is 2 or day <= 20 and month is 3:
+ return "pisces"
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))