码迷,mamicode.com
首页 > 其他好文 > 详细

有进度圆周率计算

时间:2020-04-14 20:59:33      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:sqrt   结束   nbsp   mat   code   class   style   for   orm   

from math import*
from time import* 
scale=15
p=1
q=2
print("执行开始".center(scale//2, "-"))
start = perf_counter()
for i in range(scale+1): 
    p=sqrt((1-sqrt(1-pow(p,2)))/2)
    q=q*2
    a = * * i 
    b = . * (scale - i)
    c = (i/scale)*100 
    dur = perf_counter() - start 
    print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur))
    sleep(0.1)
Pi=p*q
print("Pi值是{}".format(Pi))
print("\n"+"执行结束".center(scale//2,‘-‘))

 

有进度圆周率计算

标签:sqrt   结束   nbsp   mat   code   class   style   for   orm   

原文地址:https://www.cnblogs.com/dongyichen/p/12700537.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!