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

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

Към профила на Явор Големанов

Резултати

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

Код

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

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

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

OK

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

Явор обнови решението на 10.03.2015 22:03 (преди над 9 години)

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

Явор обнови решението на 11.03.2015 02:37 (преди над 9 години)

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