摘要: 5.1 字符田字格绘制 def draw_tianzi(size): if size < 2: print("田字格大小至少为2") return part_size = size // 2 for i in range(size+1): row = [] for j in range(size+1 阅读全文
posted @ 2025-04-20 13:13 与尔5 阅读(7) 评论(0) 推荐(0)
摘要: 4.1 猜数字(含猜测次数) target = 425 guess, count = 0, 0 while True: guess = eval(input("请输入一个猜测的整数(1-1000):")) count += 1 if guess > target: print("猜大了") elif 阅读全文
posted @ 2025-04-01 09:55 与尔5 阅读(37) 评论(0) 推荐(0)
摘要: 4.19 随机挑选0-100的奇数 import random num = random.randint(0,100) while num % 2 == 0: num = random.randint(0,100) print(num) 4.20 从fruit列表中随机挑选字符串 import ra 阅读全文
posted @ 2025-04-01 09:08 与尔5 阅读(6) 评论(0) 推荐(0)
摘要: 3.19 import time t = time.localtime() year = str(t.tm_year) month = str(t.tm_mon) day = str(t.tm_mday) result = '-'.join([year, month, day]) print(res 阅读全文
posted @ 2025-03-29 13:48 与尔5 阅读(10) 评论(0) 推荐(0)
摘要: 3.6 文本进度条Starting...Done!形式 import time scale = 10 print("Starting", end="\n") for i in range(scale+1): c = (i/scale)*100 print("\r{:.0f}%".format(c), 阅读全文
posted @ 2025-03-29 13:12 与尔5 阅读(7) 评论(0) 推荐(0)
摘要: 3.1 重量计算 s, yearup = 50, 0.50 for i in range(10): s += yearup print("{:.3f}".format(s)) print("{:.3f}".format(0.165*s)) 50.500 8.332 51.000 8.415 51.5 阅读全文
posted @ 2025-03-23 15:10 与尔5 阅读(13) 评论(0) 推荐(0)
摘要: 3.13 s = "Python String" print( s.upper() ) print( s.lower() ) print( s.find('i') ) print( s.replace('ing', 'gni') ) print( s.split(' ') ) PYYHON STRI 阅读全文
posted @ 2025-03-23 14:27 与尔5 阅读(18) 评论(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-17 10:42 与尔5 阅读(9) 评论(0) 推荐(0)
摘要: 最近AI话题引爆全网,豆包、Kimi和DeepSeek活跃在人们视野中,在各个领域大显神通。那么仅绘图方面而言,哪种AI模型会更胜一筹呢?请拭目以待! 指定任务:下“用Python绘制五星红旗”的相同指令以控制变量,生成的代码将在Python123上统一运行代码测试。 1.豆包 代码如下: 豆包版五 阅读全文
posted @ 2025-03-02 20:03 与尔5 阅读(295) 评论(0) 推荐(0)
摘要: 五星红旗 from turtle import * """绘制五角星,大小可变""" def wujiaoxing(size): for i in range(6): forward(size) right(144) """绘制红色矩形""" color("red","red") begin_fil 阅读全文
posted @ 2025-02-25 09:42 与尔5 阅读(25) 评论(0) 推荐(0)