Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
15
Task/Nth/Python/nth-2.py
Normal file
15
Task/Nth/Python/nth-2.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
def ord(n):
|
||||
try:
|
||||
s = ['st', 'nd', 'rd'][(n-1)%10]
|
||||
if (n-10)%100//10:
|
||||
return str(n)+s
|
||||
except IndexError:
|
||||
pass
|
||||
return str(n)+'th'
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(*(ord(n) for n in range(26)))
|
||||
print(*(ord(n) for n in range(250,266)))
|
||||
print(*(ord(n) for n in range(1000,1026)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue