Skip to content

Instantly share code, notes, and snippets.

View trankov's full-sized avatar

Aleksei Trankov trankov

  • ИП Траньков Алексей Леонидович
  • Perm, Russia
  • 17:32 (UTC +05:00)
View GitHub Profile
@CubexX
CubexX / plural.py
Created July 13, 2018 22:15
Python plural russian days / Склонение день/дня/дней
def plural_days(n):
days = ['день', 'дня', 'дней']
if n % 10 == 1 and n % 100 != 11:
p = 0
elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20):
p = 1
else:
p = 2