信信信

导航

 

2020年11月23日

摘要: from random import random def printInfo(): print("这个程序模拟两个选手A和B的乒乓比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = eval(input("请输入选手A的能力值 阅读全文
posted @ 2020-11-23 08:52 信信信 阅读(51) 评论(0) 推荐(0)
 

2020年11月15日

摘要: import jieba txt = open("聊斋志异白话简写版.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for w 阅读全文
posted @ 2020-11-15 10:58 信信信 阅读(49) 评论(0) 推荐(0)
 

2020年10月31日

摘要: def __init__(self, name, age ,gender): self.name = name self.age = age self.gender = gender def kanchai(self): print "%s,%s岁,%s,上山去砍柴" %(self.name, se 阅读全文
posted @ 2020-10-31 16:18 信信信 阅读(65) 评论(0) 推荐(0)
 

2020年10月26日

摘要: import turtle, datetime def drawGap(): turtle.up() turtle.fd(5) def drawLine(draw): drawGap() if(draw): turtle.down() else: turtle.up() turtle.fd(40) 阅读全文
posted @ 2020-10-26 18:44 信信信 阅读(117) 评论(0) 推荐(0)
 

2020年10月19日

摘要: pi = 0 N = 100 for k in range(N): pi += 1/pow(16,k) * (4/(8*k+1) - 2/(8*k+4) - 1/(8*k+5) - 1/(8*k+6)) print("圆周率值是:{}".format(pi)) 阅读全文
posted @ 2020-10-19 19:32 信信信 阅读(142) 评论(0) 推荐(0)
 

2020年9月21日

摘要: import turtle as t ''' t.pu() 提起画笔 t.pd() 移动时绘制图形,缺省时也为绘制 t.seth 设置当前朝向为angle角度 t.begin_fill() 准备开始填充图形 t.color 同时设置pencolor=color1, fillcolor=color2 阅读全文
posted @ 2020-09-21 18:45 信信信 阅读(137) 评论(0) 推荐(0)
 

2020年9月14日

摘要: import turtle turtle.fillcolor("red") turtle.begin_fill() count = 1 while count <= 5: turtle.forward(100) turtle.right(144) count += 1 turtle.end_fill 阅读全文
posted @ 2020-09-14 20:06 信信信 阅读(56) 评论(0) 推荐(0)