摘要:
from random import* from time import* DARTS=10001000 hits=0.0 start=perf_counter() for i in range(1,DARTS+1): x,y=random(),random() dist=pow(x2+y2,0.5 阅读全文
摘要:
while True: try: s,t=eval(input("请输入身高,请输入体重:"))#检验数据是否存在异常 BMI=t/pow(s,2) break except NameError:#如果数据不是整数的话则报错 continue print("BMI数值为:{:.2f}".format 阅读全文
摘要:
import time scale=10 print(" 执行开始 ") for i in range(scale+1): a='**'i b='..'(scale-i) c=(i/scale)*100 print("{:^3.0f}%[{}->{}]".format(c,a,b)) time.sl 阅读全文
摘要:
from turtle import* for i in range(3): fd(200) right(120) left(60) fd(200) right(120) fd(400) seth(180) fd(400) seth(60) fd(200) done 阅读全文