摘要:
from random import random def printTntro(): print("typist : 23") print("模拟比赛") print("需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = eval(input("请输入A的能 阅读全文
摘要:
import jieba txt = open("D:\download\西游记.txt", "r", encoding='gb18030').read() words = jieba.lcut(txt) counts = {} for word in words: if len(word) == 阅读全文
摘要:
from tqdm import trange pi = 0 for i in trange(1000000000): if i%2 == 0: pi += 1/(2*i+1) else: pi -= 1/(2*i+1) pi = pi*4 print(pi) 理论上迭代次数越大,数就越接近π 阅读全文
摘要:
import turtle as tt import time tt.fillcolor('red') tt.begin_fill() for _ in range(3): tt.forward(100) if abs(tt.pos())<1: break tt.right(120) tt.righ 阅读全文
摘要:
import turtle as t t.fillcolor("red") #颜色填充函数 t.begin_fill() while True: t.forward(200) #画笔向前画200像素 t.right(144) #画笔方向右转144° if abs(t.pos()) < 1:#看画笔是 阅读全文