摘要: import jieba with open('红楼梦.txt','r',encoding='utf-8')as f: txt = f.read() words = jieba.lcut(txt) counts={} for word in words: if len(word) == 1: con 阅读全文
posted @ 2023-12-27 10:22 31014552 阅读(22) 评论(0) 推荐(0)
摘要: import pygame import sys import random class Bird(object): def __init__(self): self.birdRect = pygame.Rect(65, 50, 50, 50) self.birdStatus = [pygame.i 阅读全文
posted @ 2023-12-27 09:54 31014552 阅读(26) 评论(0) 推荐(0)
摘要: import requests for i in range(20): response = requests.get("https://www.google.com") print("第{}次请求的返回状态码:{}".format(i+1, response.status_code)) print 阅读全文
posted @ 2023-12-26 21:51 31014552 阅读(23) 评论(0) 推荐(0)
摘要: '''2022310143145'''import turtle, datetime def drawGap(): turtle.penup() turtle.fd(5) def drawLine(draw): drawGap() turtle.pendown() if draw else turt 阅读全文
posted @ 2023-11-20 22:04 31014552 阅读(111) 评论(0) 推荐(0)
摘要: money_all=56.75+72.91+88.5+26.37+68.51 money_all_str=str(money_all) print("商品总金额:"+money_all_str) money_real=int(money_all) money_real_str=str(money_r 阅读全文
posted @ 2023-10-31 17:57 31014552 阅读(23) 评论(0) 推荐(0)
摘要: 求pi时可以采用蒙特卡罗的方法:随机向单位圆中和正方形中抛洒大量点,计算每个点到圆心的距离从而判断该点在圆内或圆外,用圆内的点数除以总点数。 输入:随机抛出的点数 处理:计算每个点到圆心的距离,统计在圆内的点的数量 输出:pi值 求pi的python程序为: from random import r 阅读全文
posted @ 2023-10-30 19:18 31014552 阅读(95) 评论(0) 推荐(0)