Решение на Хороскоп от Станислав Гинчев

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

Към профила на Станислав Гинчев

Резултати

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

Код

>>> #python
>>> def what_is_my_sign(month, date):
if month == 3 and date > 20 or month == 4 and date < 21 :
print("лъв")
elif month == 4 and date > 20 or month == 5 and date < 21 :
print("телец")
elif month == 5 and date > 20 or month == 6 and date < 21 :
print("близнаци")
elif month == 6 and date > 20 or month == 7 and date < 22 :
print("рак")
elif month == 7 and date > 21 or month == 8 and date < 23 :
print("лъв")
elif month == 8 and date > 22 or month == 9 and date < 23 :
print("дева")
elif month == 9 and date > 22 or month == 10 and date < 23 :
print("везни")
elif month == 10 and date > 22 or month == 11 and date < 22 :
print("скорпион")
elif month == 11 and date > 21 or month == 12 and date < 22 :
print("стрелец")
elif month == 12 and date > 21 or month == 1 and date < 20 :
print("козирог")
elif month == 1 and date > 19 or month == 2 and date < 19 :
print("водолей")
elif month == 2 and date > 18 or month == 3 and date < 21 :
print("риби")
else:
print("грешка")

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

Станислав обнови решението на 04.03.2013 16:57 (преди около 11 години)

+>>> #python
+>>> def what_is_my_sign(month, date):
+ if month == 3 and date > 20 or month == 4 and date < 21 :
+ print("лъв")
+ elif month == 4 and date > 20 or month == 5 and date < 21 :
+ print("телец")
+ elif month == 5 and date > 20 or month == 6 and date < 21 :
+ print("близнаци")
+ elif month == 6 and date > 20 or month == 7 and date < 22 :
+ print("рак")
+ elif month == 7 and date > 21 or month == 8 and date < 23 :
+ print("лъв")
+ elif month == 8 and date > 22 or month == 9 and date < 23 :
+ print("дева")
+ elif month == 9 and date > 22 or month == 10 and date < 23 :
+ print("везни")
+ elif month == 10 and date > 22 or month == 11 and date < 22 :
+ print("скорпион")
+ elif month == 11 and date > 21 or month == 12 and date < 22 :
+ print("стрелец")
+ elif month == 12 and date > 21 or month == 1 and date < 20 :
+ print("козирог")
+ elif month == 1 and date > 19 or month == 2 and date < 19 :
+ print("водолей")
+ elif month == 2 and date > 18 or month == 3 and date < 21 :
+ print("риби")
+ else:
+ print("грешка")

Това не е валиден код. Ако беше поставил това във файл и беше изпълнил тестовете щеше да установиш, че: * Някакви редове започват с невалидни символи * Функцията ти не връща нищо, а принтира разни неща