Станислав обнови решението на 08.03.2015 12:25 (преди около 10 години)
▸ Покажи разликите+def interpret_chinese_sign(year):
+ birth_year = year % 12
+ if birth_year == 0:
+ return("monkey")
+ elif birth_year == 1:
+ return("rooster")
+ elif birth_year == 2:
+ return("dog")
+ elif birth_year == 3:
+ return("pig")
+ elif birth_year == 4:
+ return("rat")
+ elif birth_year == 5:
+ return("ox")
+ elif birth_year == 6:
+ return("tiger")
+ elif birth_year == 7:
+ return("rabbit")
+ elif birth_year == 8:
+ return("dragon")
+ elif birth_year == 9:
+ return("snake")
+ elif birth_year == 10:
+ return("horse")
+ else:
+ return("sheep")
+
+
+def interpret_western_sign(day, month):
+ if month == 1:
+ if day > 20:
+ return("aquarius")
+ else:
+ return("capricorn")
+ elif month == 2:
+ if day > 18:
+ return("pisces")
+ else:
+ return("aquarius")
+ elif month == 3:
+ if day > 20:
+ return("aries")
+ else:
+ return("pisces")
+ elif month == 4:
+ if day > 20:
+ return("taurus")
+ else:
+ return("aries")
+ elif month == 5:
+ if day > 20:
+ return("gemini")
+ else:
+ return("taurus")
+ elif month == 6:
+ if day > 20:
+ return("cancer")
+ else:
+ return("gemini")
+ elif month == 7:
+ if day > 22:
+ return("leo")
+ else:
+ return("cancer")
+ elif month == 8:
+ if day > 22:
+ return("virgo")
+ else:
+ return("leo")
+ elif month == 9:
+ if day > 22:
+ return("libra")
+ else:
+ return("virgio")
+ elif month == 10:
+ if day > 22:
+ return("scorpio")
+ else:
+ return("libra")
+ elif month == 11:
+ if day > 21:
+ return("sagittarius")
+ else:
+ return("scorpio")
+ elif month == 12:
+ if day > 21:
+ return("capricorn")
+ else:
+ return("sagittarius")
+
+
+def interpret_both_signs(day, month, year):
+ western_sign = interpret_western_sign(day, month)
+ chinese_sign = interpret_chinese_sign(year)
+ both_signs = (western_sign, chinese_sign)
+
+ return both_signs
Бих те посъветвал да си пуснеш тестовете на някои твои колеги от форума. Виж си ред 67 и 74.virgo
vs virgio
. Правилно е първото.
Ако зодиите бяха 4048, пак ли щеше да имаш отделен if
за всеки случай? Опитай се да опростиш.
Така с една идея по-добре ли е ?
П.П. Пуснах и тестовете.