Решение на Хороскоп от Марин Койнов

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

Към профила на Марин Койнов

Резултати

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

Код

def what_is_my_sign (day = 1, month = 1):
astro = ("Водолей","Риби","Овен","Телец","Близнаци","Рак","Лъв","Дева","Везни","Скорпион","Стрелец","Козирог"
,20,19,21,21,21,21,22,23,23,23,22,22
,31,29,31,30,31,30,31,31,30,31,30,31)
if month >= 1 and month <= 12 and day >= 1 and day <= astro[month+11+12]:
if day >= astro[month+11]: return astro[month-1]
elif day <= astro[month+11] and month-2 < 0: return astro[11]
else: return astro[month-2]
else: return "Нeма такова животно!"

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

...............
----------------------------------------------------------------------
Ran 15 tests in 0.001s

OK

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

Марин обнови решението на 04.03.2013 15:02 (преди над 11 години)

+def what_is_my_sign (day = 1, month = 1):
+ if month == 1 and day >= 1 and day <= 19:
+ print("Козирог")
+ elif month == 1 and day >= 20 and day <= 31:
+ print("Водолей")
+ elif month == 2 and day >= 1 and day <= 18:
+ print("Водолей")
+ elif month == 2 and day >= 19 and day <= 29:
+ print("Риби")
+ elif month == 3 and day >= 1 and day <= 20:
+ print("Риби")
+ elif month == 3 and day >= 21 and day <= 31:
+ print("Овен")
+ elif month == 4 and day >= 1 and day <= 20:
+ print("Овен")
+ elif month == 4 and day >= 21 and day <= 30:
+ print("Телец")
+ elif month == 5 and day >= 1 and day <= 20:
+ print("Телец")
+ elif month == 5 and day >= 21 and day <= 31:
+ print("Близнаци")
+ elif month == 6 and day >= 1 and day <= 20:
+ print("Близнаци")
+ elif month == 6 and day >= 21 and day <= 30:
+ print("Рак")
+ elif month == 7 and day >= 1 and day <= 21:
+ print("Рак")
+ elif month == 7 and day >= 22 and day <= 31:
+ print("Лъв")
+ elif month == 8 and day >= 1 and day <= 22:
+ print("Лъв")
+ elif month == 8 and day >= 23 and day <= 31:
+ print("Дева")
+ elif month == 9 and day >= 1 and day <= 22:
+ print("Дева")
+ elif month == 9 and day >= 23 and day <= 30:
+ print("Везни")
+ elif month == 10 and day >= 1 and day <= 22:
+ print("Везни")
+ elif month == 10 and day >= 23 and day <= 31:
+ print("Скорпион")
+ elif month == 11 and day >= 1 and day <= 21:
+ print("Скорпион")
+ elif month == 11 and day >= 22 and day <= 30:
+ print("Стрелец")
+ elif month == 12 and day >= 1 and day <= 21:
+ print("Стрелец")
+ elif month == 12 and day >= 22 and day <= 31:
+ print("Козирог")
+ else:
+ print("Нема такова животно!")

Марин обнови решението на 04.03.2013 16:32 (преди над 11 години)

def what_is_my_sign (day = 1, month = 1):
- if month == 1 and day >= 1 and day <= 19:
- print("Козирог")
+ astro = ("Водолей","Риби","Овен","Телец","Близнаци","Рак","Лъв","Дева","Везни","Скорпион","Стрелец","Козирог"
- elif month == 1 and day >= 20 and day <= 31:
+ ,20,19,21,21,21,21,22,23,23,23,22,22
- print("Водолей")
+ ,31,29,31,30,31,30,31,31,30,31,30,31)
- elif month == 2 and day >= 1 and day <= 18:
+ if month >= 1 and month <= 12 and day >= 1 and day <= astro[month+11+12]:
- print("Водолей")
+ if day >= astro[month+11]: return astro[month-1]
- elif month == 2 and day >= 19 and day <= 29:
+ elif day <= astro[month+11] and month-2 < 0: return astro[11]
- print("Риби")
+ else: return astro[month-2]
- elif month == 3 and day >= 1 and day <= 20:
+ else: return "Нeма такова животно!"
- print("Риби")
- elif month == 3 and day >= 21 and day <= 31:
- print("Овен")
- elif month == 4 and day >= 1 and day <= 20:
- print("Овен")
- elif month == 4 and day >= 21 and day <= 30:
- print("Телец")
- elif month == 5 and day >= 1 and day <= 20:
- print("Телец")
- elif month == 5 and day >= 21 and day <= 31:
- print("Близнаци")
- elif month == 6 and day >= 1 and day <= 20:
- print("Близнаци")
- elif month == 6 and day >= 21 and day <= 30:
- print("Рак")
- elif month == 7 and day >= 1 and day <= 21:
- print("Рак")
- elif month == 7 and day >= 22 and day <= 31:
- print("Лъв")
- elif month == 8 and day >= 1 and day <= 22:
- print("Лъв")
- elif month == 8 and day >= 23 and day <= 31:
- print("Дева")
- elif month == 9 and day >= 1 and day <= 22:
- print("Дева")
- elif month == 9 and day >= 23 and day <= 30:
- print("Везни")
- elif month == 10 and day >= 1 and day <= 22:
- print("Везни")
- elif month == 10 and day >= 23 and day <= 31:
- print("Скорпион")
- elif month == 11 and day >= 1 and day <= 21:
- print("Скорпион")
- elif month == 11 and day >= 22 and day <= 30:
- print("Стрелец")
- elif month == 12 and day >= 1 and day <= 21:
- print("Стрелец")
- elif month == 12 and day >= 22 and day <= 31:
- print("Козирог")
- else:
- print("Нема такова животно!")