Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
15
Task/Left-factorials/Python/left-factorials.py
Normal file
15
Task/Left-factorials/Python/left-factorials.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from itertools import islice
|
||||
|
||||
def lfact():
|
||||
yield 0
|
||||
fact, summ, n = 1, 0, 1
|
||||
while 1:
|
||||
fact, summ, n = fact*n, summ + fact, n + 1
|
||||
yield summ
|
||||
|
||||
print('first 11:\n %r' % [lf for i, lf in zip(range(11), lfact())])
|
||||
print('20 through 110 (inclusive) by tens:')
|
||||
for lf in islice(lfact(), 20, 111, 10):
|
||||
print(lf)
|
||||
print('Digits in 1,000 through 10,000 (inclusive) by thousands:\n %r'
|
||||
% [len(str(lf)) for lf in islice(lfact(), 1000, 10001, 1000)] )
|
||||
Loading…
Add table
Add a link
Reference in a new issue