摘要: import pygame import random import sys special_number = 3028 初始化pygame pygame.init() 游戏窗口设置 SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 screen = pygame.dis 阅读全文
posted @ 2025-06-17 16:20 鳞* 阅读(27) 评论(0) 推荐(0)
摘要: 8.1 import random def ping_pong_match(): player1_score = 0 player2_score = 0 while True: # 随机决定得分方 winner = random.choice([1, 2]) if winner == 1: play 阅读全文
posted @ 2025-05-21 13:15 鳞* 阅读(39) 评论(0) 推荐(0)
摘要: 7.1 def rewrite_py_file(file_path): try: with open(file_path, 'r', encoding='utf - 8') as f: content = f.read() new_content = "" i = 0 while i < len(c 阅读全文
posted @ 2025-05-17 22:47 鳞* 阅读(43) 评论(0) 推荐(0)
摘要: 5.1 def print_grid(width): plus = '+' dash = ' - ' pipe = '|' space = ' ' horizontal_line = plus + (dash * width + plus) * width + '\n' vertical_line 阅读全文
posted @ 2025-04-20 15:43 鳞* 阅读(31) 评论(0) 推荐(0)
摘要: 4.1 GuessANum.py target=425 guess=0 count=0 while guess!=target: guess=eval(input('请输入一个猜测的整数(1-1000)😂) count += 1 if guess>target: print('猜大了') elif 阅读全文
posted @ 2025-04-01 14:43 鳞* 阅读(24) 评论(0) 推荐(0)
摘要: 3.6 import time print("Starting",end='') a='...' print("{:^5}".format(a),end='') print("Done!") 3.7 while True: for i in ["/","-","|","\","|"]: print( 阅读全文
posted @ 2025-03-25 13:10 鳞* 阅读(33) 评论(0) 推荐(0)
摘要: 3.1 K = 0.165 N = eval(input("请输入你的体重(kg)😊) M = KN for i in range(1,11): N += 0.5i M = K*N print("第{}年,在地球上为{:.2f}kg,在月球上为{:.2f}kg".format(i,N,M)) 3. 阅读全文
posted @ 2025-03-23 17:34 鳞* 阅读(11) 评论(0) 推荐(0)
摘要: Tempconvent.py TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in['F','f']: C = (eval(TempStr[0:-1])-32)/1.8 print("转换后的温度是{:.0f}C".format(C)) elif Tem 阅读全文
posted @ 2025-03-16 20:02 鳞* 阅读(36) 评论(0) 推荐(0)
摘要: TempConvert.py TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['F','f']: C = (eval(TempStr[0:-1]) - 32)/1.8 print("转换后的温度是{:.2f}C".format(C)) elif 阅读全文
posted @ 2025-03-16 19:08 鳞* 阅读(10) 评论(0) 推荐(0)
摘要: str1 = input("请输入一个人的名字:") str2 = input("请输入一个国家名字:") print("世界这么大,{}想去{}看看.".format(str1,str2)) n = input("请输入整数N:") sum = 0 for i in range(int(n)): 阅读全文
posted @ 2025-03-08 23:36 鳞* 阅读(20) 评论(0) 推荐(0)