摘要: 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(conte 阅读全文
posted @ 2025-05-18 20:33 magixx 阅读(14) 评论(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 21:53 magixx 阅读(23) 评论(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 19:56 magixx 阅读(34) 评论(0) 推荐(0)
摘要: 3.19 import time t = time.gmtime() print(time.strftime("%Y-%m-%d",t)) 3.20 import time current_time = time.localtime() format1 = time.strftime("%Y年%m月 阅读全文
posted @ 2025-03-30 21:39 magixx 阅读(16) 评论(0) 推荐(0)
摘要: intial_weight = 50 weight_gain = 0.5 moon_weight_ratio = 0.165 print("年份\t地球体重(kg)\t月球体重(kg)") for year in range(1,11): earth_weight = intial_weight + 阅读全文
posted @ 2025-03-23 20:09 magixx 阅读(8) 评论(0) 推荐(0)
摘要: 2.1 tempConvert.py TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['F', 'f']: C = (float(TempStr[0:-1]) - 32) / 1.8 print("转换后的温度是{:.0f}C".format(C 阅读全文
posted @ 2025-03-16 20:09 magixx 阅读(9) 评论(0) 推荐(0)
摘要: TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['f','F']: C = (eval(TempStr[0:-1]) - 32)/1.8 print("转化后的温度是{:.2f}C".format(C)) elif TempStr[-1] in 阅读全文
posted @ 2025-03-16 20:08 magixx 阅读(10) 评论(0) 推荐(0)
摘要: str1=input("请输入一个人的名字:") str2=input("请输入一个国家的名字:") print("世界那么大,{}想去{}看看".format(str1,str2)) n=input("请输入一个整数N:") sum=0 for i in range (int(n)): sum+= 阅读全文
posted @ 2025-03-09 13:58 magixx 阅读(25) 评论(0) 推荐(0)
摘要: 在阅读诸多关于大模型的资料后,收获颇丰。 大模型作为人工智能领域极具突破性的成果,以其海量的数据处理能力和强大的语言理解、生成本领震撼世人。例如,ChatGPT一经推出便备受关注,它能与人流畅对谈,无论是解答学术疑问、协助创作故事,还是进行日常聊天,都表现出色。在商业领域,大模型助力企业打造更智能的 阅读全文
posted @ 2025-03-09 13:52 magixx 阅读(56) 评论(0) 推荐(0)