Йордан обнови решението на 02.03.2013 19:25 (преди над 11 години)
+def what_is_my_sign(day, month):
+ if (month == 1 and day >= 20) or (month == 2 and day <= 18):
+ return "Водолей"
+ elif (month == 2 and day >= 19) or (month == 3 and day <= 20):
+ return "Риби"
+ elif (month == 3 and day >= 21) or (month == 4 and day <= 20):
+ return "Овен"
+ elif (month == 4 and day >= 21) or (month == 5 and day <= 20):
+ return "Телец"
+ elif (month == 5 and day >= 21) or (month == 6 and day <= 20):
+ return "Близнаци"
+ elif (month == 6 and day >= 21) or (month == 7 and day <= 21):
+ return "Рак"
+ elif (month == 7 and day >= 22) or (month == 8 and day <= 22):
+ return "Лъв"
+ elif (month == 8 and day >= 23) or (month == 9 and day <= 22):
+ return "Дева"
+ elif (month == 9 and day >= 23) or (month == 10 and day <= 22):
+ return "Везни"
+ elif (month == 10 and day >= 23) or (month == 11 and day <= 21):
+ return "Скорпион"
+ elif (month == 11 and day >= 22) or (month == 12 and day <= 21):
+ return "Стрелец"
+ else:
+ return "Козирог"
Помисли как да го направиш без толкова много if-ове. Така определено не е елегантно.