Решение на Астрологични забави от Александър Наджарян

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

Към профила на Александър Наджарян

Резултати

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

Код

WESTERN_SIGNS = [
[20, "capricorn", "aquarius"],
[18, "aquarius", "pisces"],
[20, "pisces", "aries"],
[20, "aries", "taurus"],
[20, "taurus", "gemini"],
[20, "gemini", "cancer"],
[22, "cancer", "leo"],
[22, "leo", "virgo"],
[22, "virgo", "libra"],
[22, "libra", "scorpio"],
[21, "scorpio", "sagittarius"],
[21, "sagittarius", "capricorn"]
]
CHINESE_SIGNS = [
'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger',
'rabbit', 'dragon', 'snake', 'horse', 'sheep'
]
def interpret_western_sign(day, month):
return WESTERN_SIGNS[month-1][1 + (day > WESTERN_SIGNS[month-1][0])]
def interpret_chinese_sign(year):
return CHINESE_SIGNS[year % 12]
def interpret_both_signs(day, month, year):
return interpret_western_sign(day, month), interpret_chinese_sign(year)

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

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

OK

История (4 версии и 0 коментара)

Александър обнови решението на 05.03.2015 11:07 (преди около 9 години)

+WESTERN_SIGNS = [
+ [20, "capricorn"],
+ [19, "aquarius"],
+ [20, "pisces"],
+ [20, "aries"],
+ [21, "taurus"],
+ [21, "gemini"],
+ [22, "cancer"],
+ [22, "leo"],
+ [23, "virgo"],
+ [22, "libra"],
+ [21, "scorpio"],
+ [20, "sagittarius"]
+]
+
+
+def interpret_western_sign(day, month):
+ if day <= WESTERN_SIGNS[month-1][0]:
+ return WESTERN_SIGNS[month-1][1]
+ else:
+ return WESTERN_SIGNS[month % 12][1]
+
+
+CHINESE_SIGNS = [
+ 'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger',
+ 'rabbit', 'dragon', 'snake', 'horse', 'sheep'
+]
+
+
+def interpret_chinese_sign(year):
+ return CHINESE_SIGNS[year % 12]
+
+
+def interpret_both_signs(day, month, year):
+ return interpret_western_sign(day, month), interpret_chinese_sign(year)

Александър обнови решението на 05.03.2015 23:17 (преди около 9 години)

WESTERN_SIGNS = [
- [20, "capricorn"],
- [19, "aquarius"],
- [20, "pisces"],
- [20, "aries"],
- [21, "taurus"],
- [21, "gemini"],
- [22, "cancer"],
- [22, "leo"],
- [23, "virgo"],
- [22, "libra"],
- [21, "scorpio"],
- [20, "sagittarius"]
+ [20, "capricorn", "aquarius"],
+ [19, "aquarius", "pisces"],
+ [20, "pisces", "aries"],
+ [20, "aries", "taurus"],
+ [21, "taurus", "gemini"],
+ [21, "gemini", "cancer"],
+ [22, "cancer", "leo"],
+ [22, "leo", "virgo"],
+ [23, "virgo", "libra"],
+ [22, "libra", "scorpio"],
+ [21, "scorpio", "sagittarius"],
+ [20, "sagittarius", "capricorn"]
]
-def interpret_western_sign(day, month):
- if day <= WESTERN_SIGNS[month-1][0]:
- return WESTERN_SIGNS[month-1][1]
- else:
- return WESTERN_SIGNS[month % 12][1]
-
-
CHINESE_SIGNS = [
'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger',
'rabbit', 'dragon', 'snake', 'horse', 'sheep'
]
+
+
+def interpret_western_sign(day, month):
+ return WESTERN_SIGNS[month-1][1 + (day > WESTERN_SIGNS[month-1][0])]
def interpret_chinese_sign(year):
return CHINESE_SIGNS[year % 12]
def interpret_both_signs(day, month, year):
return interpret_western_sign(day, month), interpret_chinese_sign(year)

Александър обнови решението на 06.03.2015 01:20 (преди около 9 години)

WESTERN_SIGNS = [
[20, "capricorn", "aquarius"],
[19, "aquarius", "pisces"],
[20, "pisces", "aries"],
[20, "aries", "taurus"],
- [21, "taurus", "gemini"],
- [21, "gemini", "cancer"],
+ [20, "taurus", "gemini"],
+ [20, "gemini", "cancer"],
[22, "cancer", "leo"],
[22, "leo", "virgo"],
- [23, "virgo", "libra"],
+ [22, "virgo", "libra"],
[22, "libra", "scorpio"],
[21, "scorpio", "sagittarius"],
- [20, "sagittarius", "capricorn"]
+ [21, "sagittarius", "capricorn"]
]
CHINESE_SIGNS = [
'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger',
'rabbit', 'dragon', 'snake', 'horse', 'sheep'
]
def interpret_western_sign(day, month):
return WESTERN_SIGNS[month-1][1 + (day > WESTERN_SIGNS[month-1][0])]
def interpret_chinese_sign(year):
return CHINESE_SIGNS[year % 12]
def interpret_both_signs(day, month, year):
return interpret_western_sign(day, month), interpret_chinese_sign(year)

Александър обнови решението на 06.03.2015 15:23 (преди около 9 години)

WESTERN_SIGNS = [
[20, "capricorn", "aquarius"],
- [19, "aquarius", "pisces"],
+ [18, "aquarius", "pisces"],
[20, "pisces", "aries"],
[20, "aries", "taurus"],
[20, "taurus", "gemini"],
[20, "gemini", "cancer"],
[22, "cancer", "leo"],
[22, "leo", "virgo"],
[22, "virgo", "libra"],
[22, "libra", "scorpio"],
[21, "scorpio", "sagittarius"],
[21, "sagittarius", "capricorn"]
]
CHINESE_SIGNS = [
'monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger',
'rabbit', 'dragon', 'snake', 'horse', 'sheep'
]
def interpret_western_sign(day, month):
return WESTERN_SIGNS[month-1][1 + (day > WESTERN_SIGNS[month-1][0])]
def interpret_chinese_sign(year):
return CHINESE_SIGNS[year % 12]
def interpret_both_signs(day, month, year):
return interpret_western_sign(day, month), interpret_chinese_sign(year)