摘要: 8.1 from random import random def printintro(): print("这个程序模拟两个选手A和B的某种竞技比赛") print("程序运行需要A和B的能力值(用0到1之间的小数表示)") def getinputs(): a = eval(input("请输入 阅读全文
posted @ 2025-05-25 21:19 飕飕 阅读(30) 评论(0) 推荐(0)
摘要: 7.1 import tokenize import keyword from io import BytesIO def convert_python_file(source_path, target_path): with open(source_path, 'rb') as file: tok 阅读全文
posted @ 2025-05-18 20:01 飕飕 阅读(24) 评论(0) 推荐(0)
摘要: 5.1 n = eval(input('请输入一个奇数:')) a,b,c,d = '-','+','|',' ' m = n//2 if n%2 == 1: for i in range(n): if i in [0,m,n-1]: print('{0}{1}{0}{1}{0}'.format(b 阅读全文
posted @ 2025-04-20 22:03 飕飕 阅读(9) 评论(0) 推荐(0)
摘要: 4.1 4.4 4.5 的整合 import random secret = random.randint(1, 1000) guesscuonts = 0 print(" 猜数字游戏 ") guess = eval(input("请输入1-1000的整数:")) while True: if gu 阅读全文
posted @ 2025-04-06 20:22 飕飕 阅读(18) 评论(0) 推荐(0)
摘要: 3.19 import time current_time = time.localtime() formatted_time = time.strftime("%Y-%m-%d", current_time) print("当前日期:", formatted_time) 3.20 import t 阅读全文
posted @ 2025-03-30 20:07 飕飕 阅读(15) 评论(0) 推荐(0)
摘要: 3.1 current_weight = float(input('当前体重kg:')) for i in range(1,11): current_weight += 0.5 moon_weight = current_weight*16.5/100 print('第{:.0f}年,地球体重{:. 阅读全文
posted @ 2025-03-23 20:04 飕飕 阅读(29) 评论(0) 推荐(0)
摘要: 温度转换 TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['f','F']: C = (eval(TempStr[0:-1]) - 32)/1.8 print("转化后的温度是{:.0f}21c" "C".format(C)) elif Temp 阅读全文
posted @ 2025-03-16 20:30 飕飕 阅读(23) 评论(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[- 阅读全文
posted @ 2025-03-16 20:20 飕飕 阅读(33) 评论(0) 推荐(0)
摘要: 1.1 str1 = input ("请输入一个人的名字:") str2 = input ("请输入一个国家名字:") print ("世界这么大, {} 想去 {} 看一看.".format (str1, str2)) 1.2 n = input ("请输入整数N:") sum = 0 for i 阅读全文
posted @ 2025-03-09 21:54 飕飕 阅读(50) 评论(0) 推荐(0)
摘要: https://python123.io/images/ab/25/267eac2bbecd4446c231d7bc8c95.jpg https://python123.io/images/3e/44/7a9d4e29227821750aed9dad1c2b.jpg https://python12 阅读全文
posted @ 2025-03-03 12:42 飕飕 阅读(8) 评论(0) 推荐(0)