python用factorial计算1!+2!+3!+...+10!得流程图
时间: 2023-11-12 16:04:06 浏览: 81
python计算阶乘和的方法(1!+2!+3!+…+n!)
以下是Python计算1!+2!+3!+...+10!的流程图:
![factorial_flowchart](https://i.imgur.com/5JzvZ9L.png)
代码实现:
```python
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
sum = 0
for i in range(1, 11):
sum += factorial(i)
print(sum)
```
输出结果为:4037913
阅读全文