计算“1x2x3x4”
def factorial(n):
result = n
for i in range(,n):
result *= i
return result
def main():
print factorial(4)
if __name__ == '__main__':
main()
运行结果:
# python aa.py
计算“1x2x3x4”
def factorial(n):
result = n
for i in range(,n):
result *= i
return result
def main():
print factorial(4)
if __name__ == '__main__':
main()
运行结果:
# python aa.py