摘要: 代码: from random import random#第一阶段def printIntro(): print("模拟两个选手A和B的羽毛球比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)")def getInputs(): a = eval(input("请输入选手 阅读全文
posted @ 2023-12-18 21:43 小张真的不会打代码 阅读(28) 评论(0) 推荐(0)
摘要: 小游戏,代码: import pygameimport sys# 初始化Pygamepygame.init()# 设置窗口尺寸width, height = 800, 600screen = pygame.display.set_mode((width, height))pygame.display 阅读全文
posted @ 2023-12-17 22:50 小张真的不会打代码 阅读(53) 评论(0) 推荐(0)
摘要: jieba分词,聊斋29 代码: import jiebatxt = open("D:\python-learning\liaozhai.txt", "r", encoding='utf-8').read()words = jieba.lcut(txt) counts = {}for word in 阅读全文
posted @ 2023-12-17 22:47 小张真的不会打代码 阅读(18) 评论(0) 推荐(0)
摘要: 1、使用requests的get()函数访问必应网站20次,打印返回状态,text()内容,计算text属性和content属性所返回网页内容的长度。 代码如下: import requestsfor i in range(20): r = requests.get('https://cn.bing 阅读全文
posted @ 2023-12-12 21:59 小张真的不会打代码 阅读(28) 评论(0) 推荐(0)
摘要: import turtle as timport timedef popspace(): t.penup() t.fd(5)def popline(draw): popspace() t.pendown() if draw else t.penup() t.fd(40) popspace() t.r 阅读全文
posted @ 2023-11-20 21:26 小张真的不会打代码 阅读(25) 评论(0) 推荐(0)
摘要: from random import randomfrom math import sqrtimport timeDARTS = 10**7hits = 0.0a=1start = time.perf_counter()for i in range(1, DARTS+1): x,y=random() 阅读全文
posted @ 2023-10-25 09:30 小张真的不会打代码 阅读(32) 评论(0) 推荐(0)