Решение на Хороскоп от Виктор Христосков

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

Към профила на Виктор Христосков

Резултати

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

Код

def what_is_my_sign(day, month):
signs = ['Овен', 'Телец', 'Близнаци', 'Рак', 'Лъв', 'Дева', 'Везни',
'Скорпион', 'Стрелец', 'Козирог', 'Водолей', 'Риби']
months = {
1: (19, 9, 10), 2: (18, 10, 11), 3: (20, 11, 0),
4: (20, 0, 1), 5: (20, 1, 2), 6: (20, 2, 3),
7: (21, 3, 4), 8: (22, 4, 5), 9: (22, 5, 6),
10: (22, 6, 7), 11: (21, 7, 8), 12: (21, 8, 9)}
month_info = months[month]
if day <= month_info[0]:
print(signs[month_info[1]])
else:
print(signs[month_info[2]])

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

F
Stdout:
Водолей
F
Stdout:
Овен
F
Stdout:
Рак
F
Stdout:
Козирог
F
Stdout:
Близнаци
F
Stdout:
Лъв
F
Stdout:
Везни
F
Stdout:
Близнаци
F
Stdout:
Близнаци
F
Stdout:
Риби
F
Stdout:
Стрелец
F
Stdout:
Скорпион
F
Stdout:
Близнаци
F
Stdout:
Телец
F
Stdout:
Дева

======================================================================
FAIL: test_aquaris (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 38, in test_aquaris
    self.assertEqual(solution.what_is_my_sign(2, 2), 'Водолей')
AssertionError: None != 'Водолей'

Stdout:
Водолей

======================================================================
FAIL: test_aries (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 8, in test_aries
    self.assertEqual(solution.what_is_my_sign(1, 4), 'Овен')
AssertionError: None != 'Овен'

Stdout:
Овен

======================================================================
FAIL: test_cancer (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 17, in test_cancer
    self.assertEqual(solution.what_is_my_sign(8, 7), 'Рак')
AssertionError: None != 'Рак'

Stdout:
Рак

======================================================================
FAIL: test_capricorn (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 35, in test_capricorn
    self.assertEqual(solution.what_is_my_sign(1, 1), 'Козирог')
AssertionError: None != 'Козирог'

Stdout:
Козирог

======================================================================
FAIL: test_gemini (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 14, in test_gemini
    self.assertEqual(solution.what_is_my_sign(16, 6), 'Близнаци')
AssertionError: None != 'Близнаци'

Stdout:
Близнаци

======================================================================
FAIL: test_leo (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 20, in test_leo
    self.assertEqual(solution.what_is_my_sign(1, 8), 'Лъв')
AssertionError: None != 'Лъв'

Stdout:
Лъв

======================================================================
FAIL: test_libra (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 26, in test_libra
    self.assertEqual(solution.what_is_my_sign(5, 10), 'Везни')
AssertionError: None != 'Везни'

Stdout:
Везни

======================================================================
FAIL: test_living_on_the_edge (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 44, in test_living_on_the_edge
    self.assertEqual(solution.what_is_my_sign(20, 6), 'Близнаци')
AssertionError: None != 'Близнаци'

Stdout:
Близнаци

======================================================================
FAIL: test_named_arguments (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 50, in test_named_arguments
    self.assertEqual(solution.what_is_my_sign(month=6, day=20), 'Близнаци')
AssertionError: None != 'Близнаци'

Stdout:
Близнаци

======================================================================
FAIL: test_pisces (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 41, in test_pisces
    self.assertEqual(solution.what_is_my_sign(9, 3), 'Риби')
AssertionError: None != 'Риби'

Stdout:
Риби

======================================================================
FAIL: test_sagittarius (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 32, in test_sagittarius
    self.assertEqual(solution.what_is_my_sign(11, 12), 'Стрелец')
AssertionError: None != 'Стрелец'

Stdout:
Стрелец

======================================================================
FAIL: test_scorpio (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 29, in test_scorpio
    self.assertEqual(solution.what_is_my_sign(7, 11), 'Скорпион')
AssertionError: None != 'Скорпион'

Stdout:
Скорпион

======================================================================
FAIL: test_sludge (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 47, in test_sludge
    self.assertEqual(solution.what_is_my_sign(21, 5), 'Близнаци')
AssertionError: None != 'Близнаци'

Stdout:
Близнаци

======================================================================
FAIL: test_taurus (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 11, in test_taurus
    self.assertEqual(solution.what_is_my_sign(6, 5), 'Телец')
AssertionError: None != 'Телец'

Stdout:
Телец

======================================================================
FAIL: test_virgo (test.HoroscopeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/d20130307-16279-157ibjl/test.py", line 23, in test_virgo
    self.assertEqual(solution.what_is_my_sign(2, 9), 'Дева')
AssertionError: None != 'Дева'

Stdout:
Дева

----------------------------------------------------------------------
Ran 15 tests in 0.005s

FAILED (failures=15)

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

Виктор обнови решението на 01.03.2013 03:41 (преди над 11 години)

+def what_is_my_sign(day, month):
+ signs = ['Овен', 'Телец', 'Близнаци', 'Рак', 'Лъв', 'Дева', 'Везни',
+ 'Скорпион', 'Стрелец', 'Козирог', 'Водолей', 'Риби']
+
+ months = {
+ 1: (19, 9, 10), 2: (18, 10, 11), 3: (20, 11, 0),
+ 4: (20, 0, 1), 5: (20, 1, 2), 6: (20, 2, 3),
+ 7: (21, 3, 4), 8: (22, 4, 5), 9: (22, 5, 6),
+ 10: (22, 6, 7), 11: (21, 7, 8), 12: (21, 8, 9)}
+
+ monthInfo = months[month]
+
+ if day <= monthInfo[0]:
+ print(signs[monthInfo[1]])
+ else:
+ print(signs[monthInfo[2]])

Виктор обнови решението на 01.03.2013 10:46 (преди над 11 години)

def what_is_my_sign(day, month):
signs = ['Овен', 'Телец', 'Близнаци', 'Рак', 'Лъв', 'Дева', 'Везни',
'Скорпион', 'Стрелец', 'Козирог', 'Водолей', 'Риби']
months = {
1: (19, 9, 10), 2: (18, 10, 11), 3: (20, 11, 0),
4: (20, 0, 1), 5: (20, 1, 2), 6: (20, 2, 3),
7: (21, 3, 4), 8: (22, 4, 5), 9: (22, 5, 6),
10: (22, 6, 7), 11: (21, 7, 8), 12: (21, 8, 9)}
- monthInfo = months[month]
+ month_info = months[month]
- if day <= monthInfo[0]:
- print(signs[monthInfo[1]])
+ if day <= month_info[0]:
+ print(signs[month_info[1]])
else:
- print(signs[monthInfo[2]])
+ print(signs[month_info[2]])