Решение на Астрологични забави от Дияна Кръстева

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

Към профила на Дияна Кръстева

Резултати

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

Код

zodiac= {
1: 20*["capricorn"] + 11*["aquarius"],
2: 18*["aquarius"] + 11*["pisces"],
3: 20*["pisces"] + 11*["aries"],
4: 20*["aries"] + 10*["taurus"],
5: 20*["taurus"] + 11*["gemini"],
6: 20*["gemini"] + 10*["cancer"],
7: 22*["cancer"] + 9*["leo"],
8: 22*["leo"] + 9*["virgo"],
9: 22*["virgo"] + 8*["libra"],
10: 22*["libra"] + 9*["scorpio"],
11: 21*["scorpio"] + 9*["sagittarius"],
12: 21*["sagittarius"] + 10*["capricorn"]
}
def interpret_western_sign(day, month):
return zodiac[month][day - 1]
chinese={
0:'monkey',
1:'rooster',
2:'dog',
3:'pig',
4:'rat',
5:'ox',
6:'tiger',
7:'rabbit',
8:'dragon',
9:'snake',
10:'horse',
11:'sheep'
}
def interpret_chinese_sign(year):
return chinese[year % 12]
def interpret_both_signs(day, month, year):
return interpret_western_sign(day, month), interpret_chinese_sign(year)

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

......
----------------------------------------------------------------------
Ran 6 tests in 0.006s

OK

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

Дияна обнови решението на 08.03.2015 23:14 (преди над 9 години)

+zodiac= {
+ 1: 20*["capricorn"]+11*["aquarius"],
+ 2: 18*["aquarius"]+ 11*["pisces"],
+ 3: 20*["pisces"]+11*["aries"],
+ 4: 20*["aries"]+10*["taurus"],
+ 5: 20*["taurus"]+11*["gemini"],
+ 6: 20*["gemini"]+10*["cancer"],
+ 7: 22*["cancer"]+9*["leo"],
+ 8: 22*["leo"]+9*["virgo"],
+ 9: 22*["virgo"]+8*["libra"],
+ 10: 22*["libra"]+9*["scorpio"],
+ 11: 21*["scorpio"]+9*["sagittarius"],
+ 12: 21*["sagittarius"]+10*["capricorn"]
+}
+def interpret_western_sign(day, month):
+ return zodiac[month][day-1]
+
+chinese={
+ 0:'monkey',
+ 1:'rooster',
+ 2:'dog',
+ 3:'pig',
+ 4:'rat',
+ 5:'ox',
+ 6:'tiger',
+ 7:'rabbit',
+ 8:'dragon',
+ 9:'snake',
+ 10:'horse',
+ 11:'sheep'
+}
+
+def interpret_chinese_sign(year):
+ return chinese[year%12]
+
+def interpret_both_signs(day, month, year):
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)

Дияна обнови решението на 08.03.2015 23:41 (преди над 9 години)

zodiac= {
- 1: 20*["capricorn"]+11*["aquarius"],
- 2: 18*["aquarius"]+ 11*["pisces"],
- 3: 20*["pisces"]+11*["aries"],
- 4: 20*["aries"]+10*["taurus"],
- 5: 20*["taurus"]+11*["gemini"],
- 6: 20*["gemini"]+10*["cancer"],
- 7: 22*["cancer"]+9*["leo"],
- 8: 22*["leo"]+9*["virgo"],
- 9: 22*["virgo"]+8*["libra"],
- 10: 22*["libra"]+9*["scorpio"],
- 11: 21*["scorpio"]+9*["sagittarius"],
- 12: 21*["sagittarius"]+10*["capricorn"]
+ 1: 20*["capricorn"] + 11*["aquarius"],
+ 2: 18*["aquarius"] + 11*["pisces"],
+ 3: 20*["pisces"] + 11*["aries"],
+ 4: 20*["aries"] + 10*["taurus"],
+ 5: 20*["taurus"] + 11*["gemini"],
+ 6: 20*["gemini"] + 10*["cancer"],
+ 7: 22*["cancer"] + 9*["leo"],
+ 8: 22*["leo"] + 9*["virgo"],
+ 9: 22*["virgo"] + 8*["libra"],
+ 10: 22*["libra"] + 9*["scorpio"],
+ 11: 21*["scorpio"] + 9*["sagittarius"],
+ 12: 21*["sagittarius"] + 10*["capricorn"]
}
def interpret_western_sign(day, month):
- return zodiac[month][day-1]
+ return zodiac[month][day - 1]
chinese={
- 0:'monkey',
- 1:'rooster',
- 2:'dog',
- 3:'pig',
- 4:'rat',
- 5:'ox',
- 6:'tiger',
- 7:'rabbit',
- 8:'dragon',
- 9:'snake',
- 10:'horse',
- 11:'sheep'
-}
+ 0:'monkey',
+ 1:'rooster',
+ 2:'dog',
+ 3:'pig',
+ 4:'rat',
+ 5:'ox',
+ 6:'tiger',
+ 7:'rabbit',
+ 8:'dragon',
+ 9:'snake',
+ 10:'horse',
+ 11:'sheep'
+}
def interpret_chinese_sign(year):
- return chinese[year%12]
-
+ return chinese[year % 12]
+
def interpret_both_signs(day, month, year):
- return interpret_western_sign(day, month), interpret_chinese_sign(year)
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)