当前位置:网站首页>实例026:递归求阶乘
实例026:递归求阶乘
2022-08-02 06:16:00 【懒笑翻】
题目:利用递归方法求5!。
解题:
"""
学习中遇到问题没人解答?小编创建了一个Python学习交流QQ群可扫文末的推广加群哦
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
"""
def factorial(n):
return n*factorial(n-1) if n>1 else 1
print(factorial(5))
结果:
边栏推荐
- 实验7 MPLS实验
- Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
- chrome 插件开发指南
- 数据库概论之MySQL表的增删改查2
- 有点奇怪!访问目的网址,主机能容器却不行
- MySQL 5.7 安装教程(全步骤、保姆级教程)
- typescript ‘props‘ is declared but its value is never read 解决办法
- MySQL driver jar package download -- nanny tutorial
- 8/1 思维+扩展欧几里得+树上dp
- At age 94, pioneer Turing award winner, computational complexity theory, Juris Hartmanis, died
猜你喜欢
Day 4 of HCIP
zabbix email alarm and WeChat alarm
[21天学习挑战赛——内核笔记](一)——设备树的概述(硬件、目标、效果、文件类型)
Revitalize rural circular economy and digital chain to link agricultural "ecological chain"
Nodejs installation and global configuration (super detailed)
MySQL high-level --- storage engine, index, lock
每周推荐短视频:为什么产品开发需要数字化?如何做到数字化?
Nacos installation detailed process
Leading the demand and justifying the HR value - the successful launch of the "Human Resource Leading Model HRLM"
MySQL 23 classic interviews hang the interviewer
随机推荐
Dataset:机器学习中常用数据集下载链接集合之详细攻略
yml字符串读取时转成数字了怎么解决
MySQL - Multi-table query and case detailed explanation
HCIP 第一天
打卡day05
Clapper that can interact with the audience in real time
Node installation and environment configuration
Kind of weird!Access the destination URL, the host can container but not
Xgboost报错ValueError:无效的形状:标签(1650 2)
typescript 'props' is declared but its value is never read solution
zabbix email alarm and WeChat alarm
笔记本开机黑屏提示:ERROR 0199:System Security-Security password retry count exceeded
Resolving C# non-static field, method or property "islandnum.Program.getIslandCount(int[][], int, int)" requires an object reference
.NET Static Code Weaving - Rougamo Release 1.1.0
MPLS的相关技术
[npm install error report collection] - npm ERR! code ENOTEMPTY npm ERR! syscall rmdir
速看!PMP新考纲、PMBOK第七版解读
System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可 访问的日志: Security
HCIP day 3 experiment
8/1 思维+扩展欧几里得+树上dp