会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
kk-clover
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2025年5月24日
python第13周作业
摘要: 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-24 14:07 kk/
阅读(19)
评论(0)
推荐(0)
2025年5月19日
python第12周作业
摘要: 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-19 12:43 kk/
阅读(23)
评论(0)
推荐(0)
2025年5月4日
python123第五周作业12题
摘要: import turtle import time import datetime COLORS = { 'year': 'red', 'month': 'blue', 'day': 'green', 'hour': 'purple', 'minute': 'orange' } DIGIT_SEGM
阅读全文
posted @ 2025-05-04 15:18 kk/
阅读(13)
评论(0)
推荐(0)
2025年4月26日
python123
摘要: import random def genpwd(length): # 生成一个长度为length的数字密码 password = '' for _ in range(length): password += str(random.randint(0, 9)) # 生成0-9的随机数字 return
阅读全文
posted @ 2025-04-26 22:17 kk/
阅读(28)
评论(0)
推荐(0)
2025年4月20日
python第八周作业
摘要: 书p196程序练习题 5.1 def print_grid(width): plus = '+' dash = ' - ' pipe = '|' space = ' ' horizontal_line = plus + (dash * width + plus) * width + '\n' ver
阅读全文
posted @ 2025-04-20 12:47 kk/
阅读(19)
评论(0)
推荐(0)
2025年3月31日
python第六周作业(第四章课后程序练习题)
摘要: 4.1 import random def guess_number(): target = random.randint(1, 100) count = 0 while True: guess = int(input("请输入你猜的数字(1-100): ")) count += 1 if gues
阅读全文
posted @ 2025-03-31 22:32 kk/
阅读(45)
评论(0)
推荐(0)
2025年3月29日
python第三章课后练习题
摘要: 3.19 import time date_str = time.strftime("%Y年%m月%d日",time.localtime()) print("当前日期:",date_str) 3.20 import time current_time = time.localtime() forma
阅读全文
posted @ 2025-03-29 15:20 kk/
阅读(12)
评论(0)
推荐(0)
2025年3月23日
python第三章课后程序练习题
摘要: 重量计算 earth_weight = eval(input("请输入你当前的体重(kg)😊) moon_weight = earth_weight * 0.165 for year in range(1, 11): earth_weight += 0.5 moon_weight = earth_
阅读全文
posted @ 2025-03-23 13:08 kk/
阅读(20)
评论(0)
推荐(0)
2025年3月16日
python第二章课后习题
摘要: TempConvert.py TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['F','f']: C = (eval(TempStr[0:-1]) - 32)/1.8 print("转换后的温度是{:.0f}C".format(C)) elif
阅读全文
posted @ 2025-03-16 19:35 kk/
阅读(57)
评论(0)
推荐(0)
python第二章代码1.1 2.1
摘要: 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:00 kk/
阅读(19)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告