AT
Size: a a a
AT
22
<Ч
<Ч
AT
EA
AT
A
<Ч
DS
<Ч
AT
def magic(n):
template = 'У вас {n} нов{ending_new} сообщени{ending_msg}.'
endings = [
((11, 12, 13, 14, 5, 6, 7, 8, 9, 0), 'ых', 'й'),
((1,), 'ое', 'е'),
((2, 3, 4), 'ых', 'я'),
]
for ns, ending_new, ending_msg in endings:
if any(x in ns for x in (n, n % 100, n % 10)):
return template.format(n=n, ending_new=ending_new, ending_msg=ending_msg)
22
<Ч
𝕬
<Ч
22
𝕬
22
22
def magic(n):
template = 'У вас {n} нов{ending_new} сообщени{ending_msg}.'
endings = [
((11, 12, 13, 14, 5, 6, 7, 8, 9, 0), 'ых', 'й'),
((1,), 'ое', 'е'),
((2, 3, 4), 'ых', 'я'),
]
for ns, ending_new, ending_msg in endings:
if any(x in ns for x in (n, n % 100, n % 10)):
return template.format(n=n, ending_new=ending_new, ending_msg=ending_msg)