Решение на Астрологични забави от Женя Георгиева

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

Към профила на Женя Георгиева

Резултати

  • 5 точки от тестове
  • 1 отнета точка
  • 4 точки общо
  • 3 успешни тест(а)
  • 3 неуспешни тест(а)

Код

def interepret_western_sign(day,month):
if 21<=day<=31 and month==3 or 1<=day<=20 and month==4:
return "aries"
elif 21<=day<=30 and month==4 or 1<=day<=20 and month==5:
return"taurus"
elif 21<=day<=31 and month==5 or 1<=day<=20 and month==6:
return "gemini"
elif 21<=day<=30 and month==6 or 1<=day<=22 and month==7:
return "cancer"
elif 23<=day<=31 and month==7 or 1<=day<=22 and month==8:
return "leo"
elif 23<=day<=31 and month==8 or 1<=day<=22 and month==9:
return "virgo"
elif 23<=day<=30 and month==9 or 1<=day<=22 and month==10:
return "libra"
elif 23<=day<=31 and month==10 or 1<=day<=21 and month==11:
return "scorpio"
elif 22<=day<=30 and month==11 or 1<=day<=21 and month==12:
return "sagittarius"
elif 22<=day<=31 and month==12 or 1<=day<=20 and month==1:
return "capricorn"
elif 21<=day<=31 and month==1 or 1<=day<=19 and month==2:
return "aquarius"
elif 19<=day<=29 and month==2 or 1<=day<=20 and month==3:
return "pisces"
def interpret_chinese_sign(year):
if year%12==4:
return "rat"
elif year%12==5:
return "ox"
elif year%12==6:
return "tiger"
elif year%12==7:
return "rabbit"
elif year%12==8:
return "dragon"
elif year%12==9:
return "snake"
elif year%12==10:
return "horse"
elif year%12==11:
return "sheep"
elif year%12==0:
return "monkey"
elif year%12==1:
return "rooster"
elif year%12==2:
return "dog"
elif year%12==3:
return "pig"
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day, month), interpret_chinese_sign(year))

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

.EE.E.
======================================================================
ERROR: test_intersect (test.TestSigns)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/language/python/runner.py", line 60, in thread
    raise it.exc_info[1]
  File "lib/language/python/runner.py", line 48, in run
    self.result = func(*args, **kwargs)
  File "/tmp/d20150312-24164-xwg92o/test.py", line 21, in test_intersect
    solution.interpret_both_signs(8, 5, 1989),
  File "/tmp/d20150312-24164-xwg92o/solution.py", line 54, in interpret_both_signs
    return (interpret_western_sign(day, month), interpret_chinese_sign(year))
NameError: name 'interpret_western_sign' is not defined

======================================================================
ERROR: test_leap_year (test.TestSigns)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/language/python/runner.py", line 60, in thread
    raise it.exc_info[1]
  File "lib/language/python/runner.py", line 48, in run
    self.result = func(*args, **kwargs)
  File "/tmp/d20150312-24164-xwg92o/test.py", line 32, in test_leap_year
    self.assertEqual(solution.interpret_western_sign(29, 2), 'pisces')
AttributeError: 'module' object has no attribute 'interpret_western_sign'

======================================================================
ERROR: test_western_signs (test.TestSigns)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lib/language/python/runner.py", line 60, in thread
    raise it.exc_info[1]
  File "lib/language/python/runner.py", line 48, in run
    self.result = func(*args, **kwargs)
  File "/tmp/d20150312-24164-xwg92o/test.py", line 15, in test_western_signs
    self.assertEqual(solution.interpret_western_sign(1, 5), 'taurus')
AttributeError: 'module' object has no attribute 'interpret_western_sign'

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

FAILED (errors=3)

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

Женя обнови решението на 11.03.2015 02:23 (преди над 9 години)

+def interepret_western_sign(day,month):
+ if 21<=day<=31 and month==3 or 1<=day<=20 and month==4:
+ var1="aries"
+ elif 21<=day<=31 and month==4 or 1<=day<=20 and month==5:
+ var1="taurus"
+ elif 21<=day<=31 and month==5 or 1<=day<=20 and month==6:
+ var1="gemini"
+ elif 21<=day<=31 and month==6 or 1<=day<=22 and month==7:
+ var1="cancer"
+ elif 23<=day<=31 and month==7 or 1<=day<=22 and month==8:
+ var1="leo"
+ elif 23<=day<=31 and month==8 or 1<=day<=22 and month==9:
+ var1="virgo"
+ elif 23<=day<=31 and month==9 or 1<=day<=22 and month==10:
+ var1="libra"
+ elif 23<=day<=31 and month==10 or 1<=day<=21 and month==11:
+ var1="scorpio"
+ elif 22<=day<=31 and month==11 or 1<=day<=21 and month==12:
+ var1="sagittarius"
+ elif 22<=day<=22 and month==12 or 1<=day<=20 and month==1:
+ var1="capricorn"
+ elif 21<=day<=21 and month==1 or 1<=day<=19 and month==2:
+ var1="aquarius"
+ elif 19<=day<=19 and month==2 or 1<=day<=20 and month==3:
+ var1="pisces"
+ return var1
+
+def interpret_chinese_sign(year):
+ if year%12==4:
+ var2="rat"
+ elif year%12==5:
+ va2="ox"
+ elif year%12==6:
+ var2="tiger"
+ elif year%12==7:
+ var2="rabbit"
+ elif year%12==8:
+ var2="dragon"
+ elif year%12==9:
+ var2="snake"
+ elif year%12==10:
+ var2="horse"
+ elif year%12==11:
+ var2="sheep"
+ elif year%12==0:
+ var2="monkey"
+ elif year%12==1:
+ var2="rooster"
+ elif year%12==2:
+ var2="dog"
+ elif year%12==3:
+ var2="pig"
+ return var2
+
+
+def interpret_both_signs(day, month, year):
+ return (interpret_western_sign(day, month), interpret_chinese_sign(year))

Женя обнови решението на 11.03.2015 10:00 (преди над 9 години)

def interepret_western_sign(day,month):
if 21<=day<=31 and month==3 or 1<=day<=20 and month==4:
- var1="aries"
- elif 21<=day<=31 and month==4 or 1<=day<=20 and month==5:
- var1="taurus"
+ return "aries"
+ elif 21<=day<=30 and month==4 or 1<=day<=20 and month==5:
+ return"taurus"
elif 21<=day<=31 and month==5 or 1<=day<=20 and month==6:
- var1="gemini"
- elif 21<=day<=31 and month==6 or 1<=day<=22 and month==7:
- var1="cancer"
+ return "gemini"
+ elif 21<=day<=30 and month==6 or 1<=day<=22 and month==7:
+ return "cancer"
elif 23<=day<=31 and month==7 or 1<=day<=22 and month==8:
- var1="leo"
+ return "leo"
elif 23<=day<=31 and month==8 or 1<=day<=22 and month==9:
- var1="virgo"
- elif 23<=day<=31 and month==9 or 1<=day<=22 and month==10:
- var1="libra"
+ return "virgo"
+ elif 23<=day<=30 and month==9 or 1<=day<=22 and month==10:
+ return "libra"
elif 23<=day<=31 and month==10 or 1<=day<=21 and month==11:
- var1="scorpio"
- elif 22<=day<=31 and month==11 or 1<=day<=21 and month==12:
- var1="sagittarius"
- elif 22<=day<=22 and month==12 or 1<=day<=20 and month==1:
- var1="capricorn"
- elif 21<=day<=21 and month==1 or 1<=day<=19 and month==2:
- var1="aquarius"
- elif 19<=day<=19 and month==2 or 1<=day<=20 and month==3:
- var1="pisces"
- return var1
+ return "scorpio"
+ elif 22<=day<=30 and month==11 or 1<=day<=21 and month==12:
+ return "sagittarius"
+ elif 22<=day<=31 and month==12 or 1<=day<=20 and month==1:
+ return "capricorn"
+ elif 21<=day<=31 and month==1 or 1<=day<=19 and month==2:
+ return "aquarius"
+ elif 19<=day<=29 and month==2 or 1<=day<=20 and month==3:
+ return "pisces"
def interpret_chinese_sign(year):
if year%12==4:
- var2="rat"
+ return "rat"
elif year%12==5:
- va2="ox"
+ return "ox"
elif year%12==6:
- var2="tiger"
+ return "tiger"
elif year%12==7:
- var2="rabbit"
+ return "rabbit"
elif year%12==8:
- var2="dragon"
+ return "dragon"
elif year%12==9:
- var2="snake"
+ return "snake"
elif year%12==10:
- var2="horse"
+ return "horse"
elif year%12==11:
- var2="sheep"
+ return "sheep"
elif year%12==0:
- var2="monkey"
+ return "monkey"
elif year%12==1:
- var2="rooster"
+ return "rooster"
elif year%12==2:
- var2="dog"
+ return "dog"
elif year%12==3:
- var2="pig"
- return var2
-
+ return "pig"
def interpret_both_signs(day, month, year):
return (interpret_western_sign(day, month), interpret_chinese_sign(year))