Решение на Астрологични забави от Божидар Иванов

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

Към профила на Божидар Иванов

Резултати

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

Код

def interpret_western_sign(day, month):
if month == 1 and day <= 20:
return 'capricorn'
elif month == 1 and day > 20 :
return 'aquarius'
elif month == 2 and day < 19:
return 'aquarius'
elif month == 2 and day > 18:
return 'pisces'
elif month == 3 and day < 21:
return'pisces'
elif month == 3 and day >= 21:
return 'aries'
elif month == 4 and day <= 20:
return 'aries'
elif month == 4 and day >= 21:
return 'taurus'
elif month == 5 and day < 21:
return 'taurus'
elif month == 5 and day >= 21:
return 'gemini'
elif month == 6 and day < 21:
return 'gemini'
elif month == 6 and day >= 21:
return 'cancer'
elif month == 7 and day < 23:
return 'cancer'
elif month == 7 and day >= 23:
return 'leo'
elif month == 8 and day < 23:
return 'leo'
elif month == 8 and day >= 23:
return 'virgo'
elif month == 9 and day < 23:
return 'virgo'
elif month == 9 and day >= 23:
return 'libra'
elif month == 10 and day < 23:
return 'libra'
elif month == 10 and day >= 23:
return 'scorpio'
elif month == 11 and day < 22:
return 'scorpio'
elif month == 11 and day >= 22:
return 'sagittarius'
elif month == 12 and day < 22:
return 'sagittarius'
elif month == 12 and day >= 22:
return 'capricorn'
def interpret_chinese_sign(year):
if year == 1900 or (year - 1896) % 12 == 4:
return 'rat'
elif year == 1901 or (year - 1896) % 12 == 5:
return 'ox'
elif year == 1902 or (year - 1896) % 12 == 6:
return 'tiger'
elif year == 1903 or (year - 1896) % 12 == 7:
return 'rabbit'
elif year == 1904 or (year - 1896) % 12 == 8:
return 'dragon'
elif year == 1905 or (year - 1896) % 12 == 9:
return 'snake'
elif year == 1906 or (year - 1896) % 12 == 10:
return 'horse'
elif year == 1907 or (year - 1896) % 12 == 11:
return 'sheep'
elif year == 1908 or (year - 1896) % 12 == 0:
return 'monkey'
elif year == 1909 or (year - 1896) % 12 == 1:
return 'rooster'
elif year == 1910 or (year - 1896) % 12 == 2:
return 'dog'
elif year == 1911 or (year - 1896) % 12 == 3:
return 'pig'
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day,month), interpret_chinese_sign(year))

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

......
----------------------------------------------------------------------
Ran 6 tests in 0.008s

OK

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

Божидар обнови решението на 11.03.2015 03:06 (преди над 9 години)

+def interpret_western_sign(day, month):
+ if month == 1 and day <= 20:
+ return 'capricorn'
+ elif month == 1 and day > 20 :
+ return 'aquarius'
+ elif month == 2 and day < 19:
+ return 'aquarius'
+ elif month == 2 and day > 18:
+ return 'pisces'
+ elif month == 3 and day < 21:
+ return 'pisces'
+ elif month == 3 and day >= 21:
+ return 'aries'
+ elif month == 4 and day < 20:
+ return 'aries'
+ elif month == 4 and day >= 21:
+ return 'taurus'
+ elif month == 5 and day < 21:
+ return 'taurus'
+ elif month == 5 and day >= 21:
+ return 'gemini'
+ elif month == 6 and day < 21:
+ return 'gemini'
+ elif month == 6 and day >= 21:
+ return 'cancer'
+ elif month == 7 and day < 23:
+ return 'cancer'
+ elif month == 7 and day >= 23:
+ return 'leo'
+ elif month == 8 and day < 23:
+ return 'leo'
+ elif month == 8 and day >= 23:
+ return 'virgo'
+ elif month == 9 and day < 23:
+ return 'virgo'
+ elif month == 9 and day >= 23:
+ return 'libra'
+ elif month == 10 and day < 23:
+ return 'libra'
+ elif month == 10 and day >= 23:
+ return 'scorpio'
+ elif month == 11 and day < 22:
+ return 'scorpio'
+ elif month == 11 and day >= 22:
+ return 'sagittarius'
+ elif month == 12 and day < 22:
+ return 'sagittarius'
+ elif month == 12 and day >= 22:
+ return 'capricorn'
+
+def interpret_chinese_sign(year):
+ if year == 1900 or (year - 1896) % 12 == 4:
+ return 'rat'
+ elif year == 1901 or (year - 1896) % 12 == 5:
+ return 'ox'
+ elif year == 1902 or (year - 1896) % 12 == 6:
+ return 'tiger'
+ elif year == 1903 or (year - 1896) % 12 == 7:
+ return 'rabbit'
+ elif year == 1904 or (year - 1896) % 12 == 8:
+ return 'dragon'
+ elif year == 1905 or (year - 1896) % 12 == 9:
+ return 'snake'
+ elif year == 1906 or (year - 1896) % 12 == 10:
+ return 'horse'
+ elif year == 1907 or (year - 1896) % 12 == 11:
+ return 'sheep'
+ elif year == 1908 or (year - 1896) % 12 == 0:
+ return 'monkey'
+ elif year == 1909 or (year - 1896) % 12 == 1:
+ return 'rooster'
+ elif year == 1910 or (year - 1896) % 12 == 2:
+ return 'dog'
+ elif year == 1911 or (year - 1896) % 12 == 3:
+ return 'pig'
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day,month), interpret_chinese_sign(year))

Божидар обнови решението на 11.03.2015 03:10 (преди над 9 години)

def interpret_western_sign(day, month):
if month == 1 and day <= 20:
return 'capricorn'
elif month == 1 and day > 20 :
return 'aquarius'
elif month == 2 and day < 19:
return 'aquarius'
elif month == 2 and day > 18:
return 'pisces'
elif month == 3 and day < 21:
- return 'pisces'
+ return'pisces'
elif month == 3 and day >= 21:
return 'aries'
elif month == 4 and day < 20:
return 'aries'
elif month == 4 and day >= 21:
return 'taurus'
elif month == 5 and day < 21:
return 'taurus'
elif month == 5 and day >= 21:
return 'gemini'
elif month == 6 and day < 21:
return 'gemini'
elif month == 6 and day >= 21:
return 'cancer'
elif month == 7 and day < 23:
return 'cancer'
elif month == 7 and day >= 23:
return 'leo'
elif month == 8 and day < 23:
return 'leo'
elif month == 8 and day >= 23:
return 'virgo'
elif month == 9 and day < 23:
return 'virgo'
elif month == 9 and day >= 23:
return 'libra'
elif month == 10 and day < 23:
return 'libra'
elif month == 10 and day >= 23:
return 'scorpio'
elif month == 11 and day < 22:
return 'scorpio'
elif month == 11 and day >= 22:
return 'sagittarius'
elif month == 12 and day < 22:
return 'sagittarius'
elif month == 12 and day >= 22:
return 'capricorn'
def interpret_chinese_sign(year):
if year == 1900 or (year - 1896) % 12 == 4:
return 'rat'
elif year == 1901 or (year - 1896) % 12 == 5:
return 'ox'
elif year == 1902 or (year - 1896) % 12 == 6:
- return 'tiger'
+ return 'tiger'
elif year == 1903 or (year - 1896) % 12 == 7:
- return 'rabbit'
+ return 'rabbit'
elif year == 1904 or (year - 1896) % 12 == 8:
- return 'dragon'
+ return 'dragon'
elif year == 1905 or (year - 1896) % 12 == 9:
- return 'snake'
+ return 'snake'
elif year == 1906 or (year - 1896) % 12 == 10:
return 'horse'
elif year == 1907 or (year - 1896) % 12 == 11:
- return 'sheep'
+ return 'sheep'
elif year == 1908 or (year - 1896) % 12 == 0:
- return 'monkey'
+ return 'monkey'
elif year == 1909 or (year - 1896) % 12 == 1:
- return 'rooster'
+ return 'rooster'
elif year == 1910 or (year - 1896) % 12 == 2:
- return 'dog'
+ return 'dog'
elif year == 1911 or (year - 1896) % 12 == 3:
- return 'pig'
+ return 'pig'
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day,month), interpret_chinese_sign(year))

Божидар обнови решението на 11.03.2015 13:18 (преди над 9 години)

def interpret_western_sign(day, month):
if month == 1 and day <= 20:
return 'capricorn'
elif month == 1 and day > 20 :
return 'aquarius'
elif month == 2 and day < 19:
return 'aquarius'
elif month == 2 and day > 18:
return 'pisces'
elif month == 3 and day < 21:
return'pisces'
elif month == 3 and day >= 21:
return 'aries'
- elif month == 4 and day < 20:
+ elif month == 4 and day <= 20:
return 'aries'
elif month == 4 and day >= 21:
return 'taurus'
elif month == 5 and day < 21:
return 'taurus'
elif month == 5 and day >= 21:
return 'gemini'
elif month == 6 and day < 21:
return 'gemini'
elif month == 6 and day >= 21:
return 'cancer'
elif month == 7 and day < 23:
return 'cancer'
elif month == 7 and day >= 23:
return 'leo'
elif month == 8 and day < 23:
return 'leo'
elif month == 8 and day >= 23:
return 'virgo'
elif month == 9 and day < 23:
return 'virgo'
elif month == 9 and day >= 23:
return 'libra'
elif month == 10 and day < 23:
return 'libra'
elif month == 10 and day >= 23:
return 'scorpio'
elif month == 11 and day < 22:
return 'scorpio'
elif month == 11 and day >= 22:
return 'sagittarius'
elif month == 12 and day < 22:
return 'sagittarius'
elif month == 12 and day >= 22:
return 'capricorn'
def interpret_chinese_sign(year):
if year == 1900 or (year - 1896) % 12 == 4:
return 'rat'
elif year == 1901 or (year - 1896) % 12 == 5:
return 'ox'
elif year == 1902 or (year - 1896) % 12 == 6:
return 'tiger'
elif year == 1903 or (year - 1896) % 12 == 7:
return 'rabbit'
elif year == 1904 or (year - 1896) % 12 == 8:
return 'dragon'
elif year == 1905 or (year - 1896) % 12 == 9:
return 'snake'
elif year == 1906 or (year - 1896) % 12 == 10:
return 'horse'
elif year == 1907 or (year - 1896) % 12 == 11:
return 'sheep'
elif year == 1908 or (year - 1896) % 12 == 0:
return 'monkey'
elif year == 1909 or (year - 1896) % 12 == 1:
return 'rooster'
elif year == 1910 or (year - 1896) % 12 == 2:
return 'dog'
elif year == 1911 or (year - 1896) % 12 == 3:
return 'pig'
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day,month), interpret_chinese_sign(year))