Toggle navigation
Sunday Blog
All Posts
go
kubernetes
linux
python
ARCHIVE
DOCS
ABOUT
Sunday Blog
人生是一场刻意练习
Python 阶乘
Factorial
0!=1 1!=1 2!=1*2 3!=1*2*3 4!=1*2*3*4 ... for def factorial(n): p=1 for i in range(1,n): p*=i return p print(factorial(5)) 120 for递归 def factorial(n,p=1): if n==1: return p p*=n return factorial(n-1,p) print(factorial(6)) 720 def factorial(n,p=1): return p if n<2 else factorial(n-1,p*n) print(factorial(5)) 公式法 def factorial(n): if n< 2: return n return n*factorial(n-1) print(factorial(5)) 120
Posted by BlueFat on Sunday, August 14, 2022
Python斐波那契数列
Fibonacci Sequence
斐波那契数列指的是这样一个数列:1,1,2,3,5,8,13,21,34,55,89… 这个数列从第3项开始,每一项都等于前两项
Posted by BlueFat on Saturday, August 13, 2022
开心的蓝胖
QUICK LINKS
Pxhere
unsplash
FEATURED TAGS
ansible
bash
calico
containerd
docker
firewalld
flannel
grpc
https
iptables
keepalived
kernel
kubernetes
linux
lvs
mysql
network
nginx
prometheus
python
rabbitmq
rocketmq
shell
sort
ssh
tcp
tcpdump
ubuntu
ufw
性能
排序
正则表达式
算法
递归
闭包
FRIENDS
Sunday Docs
Ansible Wiki
K8S训练营
Kubernetes 实践指南