摘要: import pygame import random import sys 初始化pygame pygame.init() 定义颜色 WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BL 阅读全文
posted @ 2025-06-21 15:05 彭66 阅读(2) 评论(0) 推荐(0)
摘要: 在当今数字化飞速发展的时代,编程技能已成为一项极具竞争力的能力。而Python,以其简洁易读的语法、丰富的库和广泛的应用领域,成为了我踏入编程世界的首选语言。经过一段时间的学习与实践,我对Python有了更为深入的理解和感悟,以下便是我的Python学习心得。 最初接触Python时,我就被它简洁明 阅读全文
posted @ 2025-06-21 14:34 彭66 阅读(8) 评论(0) 推荐(0)
摘要: 简易植物大战僵尸模拟 学号后四位是 3018,这里作为特殊标志 定义植物类 class Plant: def init(self, name, attack): self.name = name self.attack = attack def attack_zombie(self, zombie) 阅读全文
posted @ 2025-06-21 13:00 彭66 阅读(5) 评论(0) 推荐(0)
摘要: import jieba from wordcloud import WordCloud import matplotlib.pyplot as plt 示例文本 text = "聊斋志异.txt" 使用 jieba 进行分词 seg_list = jieba.cut(text) seg_text 阅读全文
posted @ 2025-06-18 11:28 彭66 阅读(3) 评论(0) 推荐(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 19:49 彭66 阅读(25) 评论(0) 推荐(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 16:09 彭66 阅读(19) 评论(0) 推荐(0)
摘要: def print_tic_tac_toe_grid(width): # 检查输入是否为奇数 if width % 2 == 0: print("请输入一个奇数作为田字格的宽度。") return # 打印上半部分的田字格 for i in range((width + 1) // 2): # 打印 阅读全文
posted @ 2025-04-20 14:09 彭66 阅读(12) 评论(0) 推荐(0)
摘要: num=425 guess=0 i=0 while guess!=num: guess=eval(input("请输入1-1000的数字")) if guess>num: i+=1 elif guess<num: i+=1 else: i+=1 print(i) str_s=input(" ") n 阅读全文
posted @ 2025-04-06 19:59 彭66 阅读(23) 评论(0) 推荐(0)
摘要: 3.19 import time current_time=time.time() local_time=time.localtime(current_time) formatted_time=time.strftime("%Y-%m-%d",local_time) print("当前日期(年-月- 阅读全文
posted @ 2025-03-30 11:53 彭66 阅读(6) 评论(0) 推荐(0)
摘要: height def weightup(weightup): weight = 70 for i in range(1,11): weight=weight+weightup return weight df=0.5 e=weightup(df)9.8 m=weightup(df)9.8*0.165 阅读全文
posted @ 2025-03-23 10:54 彭66 阅读(9) 评论(0) 推荐(0)