HOME/Articles/

simple python-example-25 (snippet)

Article Outline

Python example 'python-example-25'

python-example-25

Python example: python-example-25

#!/usr/bin/python
# -*- coding: UTF-8 -*-

n = 0
s = 0
t = 1
for n in range(1,21):
    t *= n
    s += t
print('1! + 2! + 3! + ... + 20! = %d' % s)