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

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

Към профила на Антон Пенов

Резултати

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

Код

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

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

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

OK

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

Антон обнови решението на 10.03.2015 17:45 (преди около 9 години)

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

Антон обнови решението на 10.03.2015 17:48 (преди около 9 години)

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

Антон обнови решението на 11.03.2015 01:14 (преди около 9 години)

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