Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # n_suffix.py
- def n_suffix(n):
- if n:
- print n % 10
- suffix = "th"
- if n < 4 or (n > 20 and n%10 in [1,2,3]):
- suffix = ["st", "nd", "rd"][n%10-1]
- return str(n)+suffix
- #
- for z in range(50): print n_suffix(z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement