摘要: import jieba from collections import Counter def analyze_hongloumeng(): # 假设红楼梦全文文件名为 'hongloumeng.txt',与脚本在同一目录下 file_path = r"C:\Users\xxx\Downloads 阅读全文
posted @ 2025-06-22 18:13 渔樵伴夜归客 阅读(14) 评论(0) 推荐(0)
摘要: 在接触Python语言基础学习之前,我对编程充满好奇又略带畏惧。但经过一段时间的学习,Python简洁优雅的语法和强大的功能,彻底改变了我的认知,让我感受到编程的乐趣与魅力。 Python的语法十分简洁直观,没有繁琐的符号和复杂的格式要求,例如使用缩进来表示代码块,这种独特的设计让代码结构清晰明了, 阅读全文
posted @ 2025-06-22 17:11 渔樵伴夜归客 阅读(42) 评论(0) 推荐(0)
摘要: import pygame import random import copy import sys import math import time 初始化pygame pygame.init() 设置屏幕大小为 650*650 screen_width, screen_height = 650, 阅读全文
posted @ 2025-06-18 18:17 渔樵伴夜归客 阅读(15) 评论(0) 推荐(0)
摘要: import pygame import random import copy import sys import math 初始化pygame pygame.init() 设置屏幕大小 screen_width, screen_height = 500, 500 screen = pygame.d 阅读全文
posted @ 2025-06-17 16:26 渔樵伴夜归客 阅读(11) 评论(0) 推荐(0)
摘要: 第13周 import random def printIntro(): print("这个程序模拟两个选手A和B的乒乓球竞技比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = float(input("请输入选手A的能力值(0 阅读全文
posted @ 2025-05-25 20:23 渔樵伴夜归客 阅读(25) 评论(0) 推荐(0)
摘要: 264页作业 作业7.1 import tokenize import keyword from io import BytesIO def convert_python_file(source_path, target_path): with open(source_path, 'rb') as 阅读全文
posted @ 2025-05-18 19:01 渔樵伴夜归客 阅读(14) 评论(0) 推荐(0)
摘要: 5.1 def drawaq(n): line = 3n+1 for i in range(1,line+1): if i%3 == 1: print(n"+ ",end="") print("+") else: print("| "*n,end="") print("|") n = eval(in 阅读全文
posted @ 2025-04-20 19:15 渔樵伴夜归客 阅读(38) 评论(0) 推荐(0)
摘要: 习题4.1 target = 425 guess = 0 F = 1 while guess != target: guess = eval(input("请输入一个猜测的整数(1至1000):")) if guess > target: print("猜大了") F += 1 elif guess 阅读全文
posted @ 2025-04-06 18:38 渔樵伴夜归客 阅读(14) 评论(0) 推荐(0)
摘要: 习题3.19 import time t = time.gmtime() print(time.strftime("%Y-%m-%d",t)) 习题3.20 import time t = time.gmtime() print(time.strftime("%Y-%m-%d",t)) print( 阅读全文
posted @ 2025-03-30 18:57 渔樵伴夜归客 阅读(32) 评论(0) 推荐(0)
摘要: 3.1 xo=50 x=0.5 for year in range(1,11): earthweight=xo+xyear moonweight=earthweight0.165 print(f"{moonweight:.2f}") print(f"{earthweight:.2f}") 3.2 a 阅读全文
posted @ 2025-03-23 19:25 渔樵伴夜归客 阅读(23) 评论(0) 推荐(0)