請教個python編程中1個簡單問題?
1
2
3
4
5
6
7
8
9
10
11
12
13
def fac(num):
if num > 1:
#在此處調整代碼
result = num
for i in range (1, num):
result = result * i
return result
else:
return 1
number = int(input('Please input a natural number:'))
answer = fac(number)
print('The factorial of %d is %d.'%(number,answer))
上一篇小程序代碼格式
下一篇小程序自助搭建源碼哪里有