Python-天天向上的力量
程序员文章站
2022-05-18 07:55:19
...
坚持所产生的价值
假如每天进步1%,或者每天退步1%,一年以后呢
n = 0.01
up = 1
for i in range(365):
up *= (1+n)
down = 1
for i in range(365):
down *= (1-n)
print(up)
print(down)
---------------------------
37.783434332887275
0.025517964452291122
每天千分之一呢?
n = 0.001
up = 1
for i in range(365):
up *= (1+n)
down = 1
for i in range(365):
down *= (1-n)
print(up)
print(down)
------------------------------
1.440251313429521
0.6940698870404746
工作日努力,周末不努力呢?
n = 0.01
up = 1
for i in range(365):
if i%7 in [0,6]:
up *= (1-n)
else:
up *= (1+n)
print(up)
-----------------------------
4.626500529730141
要是三天打鱼两天晒网呢
n = 0.01
up = 1
for i in range(365):
if i%5 in [0,4]:
up *= (1-n)
else:
up *= (1+n)
print(up)
---------------------------
2.037601584335459
上一篇: python-天天向上的力量