摘要:
import jieba from collections import Counter import re with open('xiyouji.txt', 'r', encoding='utf-8') as f: text = f.read() words = jieba.lcut(text)
阅读全文
posted @ 2025-06-17 08:00
雨水啊
阅读(3)
推荐(0)
摘要:
import pygame import random import sys 初始化pygame pygame.init() 游戏常量 SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600 GRID_SIZE = 80 LANES = 5 COLUMNS = 9 FPS =
阅读全文
posted @ 2025-06-17 07:54
雨水啊
阅读(48)
推荐(0)
摘要:
import random def printIntro(): print("这个程序模拟两个选手A和B的乒乓球竞技比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = float(input("请输入选手A的能力值(0-1):
阅读全文
posted @ 2025-05-25 18:33
雨水啊
阅读(83)
推荐(0)
摘要:
import keyword def rewrite_py_file(input_file_path, output_file_path): with open(input_file_path, 'r', encoding='utf - 8') as f: content = f.read() ne
阅读全文
posted @ 2025-05-18 14:46
雨水啊
阅读(64)
推荐(0)
摘要:
import decimal from tqdm import tqdm def calculate_pi(iterations): # 设置高精度计算环境 decimal.getcontext().prec = 1000 # 可根据需要调整精度 a = decimal.Decimal(1) b =
阅读全文
posted @ 2025-04-26 13:58
雨水啊
阅读(137)
推荐(0)
摘要:
def drawsquare(num): a=int(num**0.5) for i in range(a): print(a"+ "+"+") for j in range(3): print(a"| "+"|") print(a"+ "+"+") n=eval(input("请输入正整数:"))
阅读全文
posted @ 2025-04-20 17:28
雨水啊
阅读(15)
推荐(0)
摘要:
习题2.1 TempConvert.py TempStr = eval(input("请输入温度值:")) Fuhao = input("请输入对应温度的符号:") if Fuhao in ['F','f']: C = (TempStr-32)/1.8 print("转换后的温度是{:.0f}C".
阅读全文
posted @ 2025-03-16 17:28
雨水啊
阅读(16)
推荐(0)
摘要:
画蛇 import turtle turtle.setup(650, 350, 200, 200) turtle.penup() turtle.fd(-250) turtle.pendown() turtle.pensize(25) turtle.pencolor("purple") turtle.
阅读全文
posted @ 2025-03-16 13:05
雨水啊
阅读(17)
推荐(0)
摘要:
str1=input("请输入一个人的名字:") str2=input("请输入一个国家的名字:") print("世界那么大,{}想去{}看看".format(str1,str2)) n=input("请输入一个整数N:") sum=0 for i in range (int(n)): sum+=
阅读全文
posted @ 2025-03-09 18:42
雨水啊
阅读(21)
推荐(0)
摘要:
import turtle 设置屏幕 screen = turtle.Screen() screen.bgcolor("white") 创建一个turtle对象 pen = turtle.Turtle() pen.shape("turtle") pen.color("pink") pen.speed
阅读全文
posted @ 2025-03-02 21:28
雨水啊
阅读(34)
推荐(0)