标签:圆周率 orm 进度条 print 进度 range import span i+1
#带有进度条的圆周率计算
1 import time 2 m = 100 3 pi = 0 4 for i in range(m): 5 a =‘*‘*i 6 b =‘.‘*(m-i) 7 c = ((i+1)/m)*100 8 print("\r{:<3.0f}%[{}->{}]".format(c,a,b),end=‘‘) 9 time.sleep(0.05) 10 pi = pi +1/pow(16,i)*(4/(8*i+1)-2/(8*i+4)-1/(8*i+5)-1/(8*i+6)) 11 print("\n") 12 print(pi)
标签:圆周率 orm 进度条 print 进度 range import span i+1
原文地址:https://www.cnblogs.com/1234f/p/12547042.html