摘要: from random import random#打印程序介绍信息def printintro(): print("这个程序模拟两个选手a和b的乒乓球比赛") print("程序运行需要a和b的能力值(以0到1之间的小数表示)")#获得程序运行参数def printinputs(): a = ev 阅读全文
posted @ 2023-12-26 14:03 luzhikang 阅读(24) 评论(0) 推荐(0)
摘要: import sysimport pygamepygame.init() # 初始化pygamesize = width, height = 640, 800screen = pygame.display.set_mode(size) # 显示窗口color = (0, 0, 0) # 设置颜色ba 阅读全文
posted @ 2023-12-26 13:36 luzhikang 阅读(20) 评论(0) 推荐(0)
摘要: import jiebawith open('E:\西游记.txt','r',encoding='utf-8')as f: # 打开文件 txt = f.read() # 读取为txt words = jieba.lcut(txt) # 利用jieba库的lcut分词 counts={} # 创建字 阅读全文
posted @ 2023-12-26 13:12 luzhikang 阅读(31) 评论(0) 推荐(0)
摘要: import requestsdef getHTMLText(url): try: r = requests.get(url, timeout=30) r.raise_for_status() r.encoding = 'utf-8' return r.text except: return " " 阅读全文
posted @ 2023-12-13 10:57 luzhikang 阅读(11) 评论(0) 推荐(0)
摘要: import turtle, datetimedef drawGap(): # 绘制数码管间隔 turtle.penup() turtle.fd(5)def drawLine(draw): # 绘制单段数码管 drawGap() turtle.pendown() if draw else turtl 阅读全文
posted @ 2023-11-21 11:49 luzhikang 阅读(26) 评论(0) 推荐(0)
摘要: #03超市抹零结账3131money = eval(input("请输入商品总价:"))print("抹零后应收{}元".format(int(money))) #04计算学生成绩的分差和平均分3131student1_point = eval(input("请输入学生成绩:"))student2_ 阅读全文
posted @ 2023-10-31 21:13 luzhikang 阅读(23) 评论(0) 推荐(0)
摘要: from random import randomfrom math import sqrtfrom time import perf_counterDARTS = 9999999hits = 0.0perf_counter()for i in range(1, DARTS+1): x, y = r 阅读全文
posted @ 2023-10-30 22:02 luzhikang 阅读(27) 评论(0) 推荐(0)