Daniele Fucini 606cf399b9
Add more python solutions
Added python solutions for problems 19 and 20
2019-09-19 21:43:55 +02:00

26 lines
432 B
Python

#!/usr/bin/python3
from math import factorial
from timeit import default_timer
def main():
start = default_timer()
n = str(factorial(100))
sum_ = 0
for i in range(len(n)):
sum_ = sum_ + int(n[i])
end = default_timer()
print('Project Euler, Problem 20')
print('Answer: {}'.format(sum_))
print('Elapsed time: {:.9f} seconds'.format(end - start))
if __name__ == '__main__':
main()