Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
124
Task/Eban-numbers/Python/eban-numbers.py
Normal file
124
Task/Eban-numbers/Python/eban-numbers.py
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# Use inflect
|
||||
|
||||
"""
|
||||
|
||||
show all eban numbers <= 1,000 (in a horizontal format), and a count
|
||||
show all eban numbers between 1,000 and 4,000 (inclusive), and a count
|
||||
show a count of all eban numbers up and including 10,000
|
||||
show a count of all eban numbers up and including 100,000
|
||||
show a count of all eban numbers up and including 1,000,000
|
||||
show a count of all eban numbers up and including 10,000,000
|
||||
|
||||
"""
|
||||
|
||||
import inflect
|
||||
import time
|
||||
|
||||
before = time.perf_counter()
|
||||
|
||||
p = inflect.engine()
|
||||
|
||||
# eban numbers <= 1000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers up to and including 1000:')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1,1001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
print(str(i)+' ',end='')
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
# eban numbers 1000 to 4000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers between 1000 and 4000 (inclusive):')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1000,4001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
print(str(i)+' ',end='')
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
# eban numbers up to 10000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers up to and including 10000:')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1,10001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
# eban numbers up to 100000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers up to and including 100000:')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1,100001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
# eban numbers up to 1000000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers up to and including 1000000:')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1,1000001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
# eban numbers up to 10000000
|
||||
|
||||
print(' ')
|
||||
print('eban numbers up to and including 10000000:')
|
||||
print(' ')
|
||||
|
||||
count = 0
|
||||
|
||||
for i in range(1,10000001):
|
||||
if not 'e' in p.number_to_words(i):
|
||||
count += 1
|
||||
|
||||
print(' ')
|
||||
print('count = '+str(count))
|
||||
print(' ')
|
||||
|
||||
after = time.perf_counter()
|
||||
|
||||
print(" ")
|
||||
print("Run time in seconds: "+str(after - before))
|
||||
Loading…
Add table
Add a link
Reference in a new issue