Python-100-Days/Day01-15/code/Day04/for3.py

14 lines
191 B
Python
Raw Normal View History

2018-03-02 00:09:06 +08:00
"""
输入非负整数n计算n!
Version: 0.1
Author: 骆昊
Date: 2018-03-01
"""
n = int(input('n = '))
result = 1
for x in range(1, n + 1):
2019-05-03 21:17:36 +08:00
result *= x
2018-03-02 00:09:06 +08:00
print('%d! = %d' % (n, result))