摘要: 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 阅读(14) 评论(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 阅读(19) 评论(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 阅读(16) 评论(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 阅读(60) 评论(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 阅读(23) 评论(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 阅读(26) 评论(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 阅读(38) 评论(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-22 23:20 he0608 阅读(35) 评论(0) 推荐(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 20:12 he0608 阅读(22) 评论(0) 推荐(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 20:11 he0608 阅读(25) 评论(0) 推荐(0)