-
-
Save imgVOID/528b36e58454c802475138931d600922 to your computer and use it in GitHub Desktop.
Python plural russian days / Склонение день/дня/дней
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
return str(n) + ' ' + days[p] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment