Так, ниже я получил: return century == year // 100 + 1 or century == year/100
Python 3 булевы
Однако, я не удовлетворяющих последний:
>>>in_century(2013, 20)
False
Как сделать так, что это только Истина, если век точно равна году, деленному на 100? Кроме того, является ли формат выражения более или менее правильным?
Спасибо!
Вот вопрос:
def in_century(year, century):
'''(int, int) -> bool
Return True iff year is in century.
Remember, for example, that 1900 is the last year of the 19th century,
not the beginning of the 20th.
year will be at least 1.
>>> in_century(1994, 20)
True
>>> in_century(1900, 19)
True
>>> in_century(2013, 20)
False
'''
(год - 1) // 100 + 1 – cerkiewny