Skip to content

Instantly share code, notes, and snippets.

@maxp
Created October 17, 2009 10:12
Show Gist options
  • Save maxp/212313 to your computer and use it in GitHub Desktop.
Save maxp/212313 to your computer and use it in GitHub Desktop.
def plural( n, s ):
'''returns one of three s[] depends on number
[1-час,234-часа,5-часов,]
'''
n = abs(n)
if n in (11,12,13,14):
return s[2]
n = n % 10
if n == 1:
return s[0]
if n in (2,3,4):
return s[1]
return s[2]
#---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment