摘要: 学习Python的心得体会 学习Python的这段时光,对我来说是一段充满挑战与惊喜的奇妙旅程。从最初的懵懂无知,到如今能够运用Python解决实际问题,每一步都饱含着探索的艰辛与收获的喜悦,也让我对这门编程语言有了深刻的理解和独特的感悟。 在学习Python之初,我被它简洁、易读的语法所吸引。与其 阅读全文
posted @ 2025-06-23 14:04 he0608 阅读(1) 评论(0) 推荐(0)
摘要: import jieba from collections import Counter import re 首先需要准备聊斋志异的文本文件(假设为liaozhai.txt) 这里我们定义一个函数来读取文件内容 def read_text(file_path): with open("d:聊斋志异. 阅读全文
posted @ 2025-06-21 20:32 he0608 阅读(2) 评论(0) 推荐(0)
摘要: import pygame import random import sys 初始化 pygame.init() WIDTH, HEIGHT = 800, 600 GRID_SIZE = 20 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pyg 阅读全文
posted @ 2025-06-21 16:31 he0608 阅读(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-26 10:58 he0608 阅读(2) 评论(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-19 12:29 he0608 阅读(5) 评论(0) 推荐(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 16:04 he0608 阅读(3) 评论(0) 推荐(0)
摘要: arget=425 guess=0 num=0 while guess!=target: guess=int(input("Enter a number between 1 and 1000: ")) num+=1 if guess<target: print("猜小了!") elif guess> 阅读全文
posted @ 2025-04-06 19:45 he0608 阅读(31) 评论(0) 推荐(0)
摘要: import time now = time.time() now_gmtime = time.gmtime(now) nowtime = time.strftime("%Y-%m-%d %H:%M:%S", now_gmtime) print(nowtime) import time curren 阅读全文
posted @ 2025-03-30 18:23 he0608 阅读(6) 评论(0) 推荐(0)
摘要: import time now = time.time() now_gmtime = time.gmtime(now) nowtime = time.strftime("%Y-%m-%d %H:%M:%S", now_gmtime) print(nowtime) import time curren 阅读全文
posted @ 2025-03-30 17:31 he0608 阅读(9) 评论(0) 推荐(0)
摘要: Earth_weight=75 for i in range(10): Earth_weight+=0.5 MooN_weight=Earth_weight0.165 print("第{}年,地球上的体重是{},月球上的体重是{:.3f}".format(i+1,Earth_weight,MooN_ 阅读全文
posted @ 2025-03-23 16:13 he0608 阅读(23) 评论(0) 推荐(0)