摘要: 4.1 点击查看代码 #GuessANumMore.py target = 425 guess = 0 n = 0 while guess != target: guess = eval(input("请输入一个猜测的整数(1至1000):")) n += 1 if guess != target: 阅读全文
posted @ 2025-04-06 21:12 等雾语 阅读(16) 评论(0) 推荐(0)
摘要: 5.1 点击查看代码 #5.1 字符田字格绘制 def TianZiGe(n): a = 5*n+1 for i in range(1,a+1): if i%5 == 1: print("+ " * n+"+") else: print("| " * n+"|") def main(): n = i 阅读全文
posted @ 2025-04-06 21:05 等雾语 阅读(32) 评论(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(' ')) 3.14 点击查看代码 pri 阅读全文
posted @ 2025-03-30 21:21 等雾语 阅读(10) 评论(0) 推荐(0)
摘要: 3.1 点击查看代码 dayup = pow((1.0 + 0.001), 365) daydown = pow((1.0 - 0.001), 365) print("向上 :{:.2f},休闲 :{:.2f}.".format(dayup, daydown)) 3.2 点击查看代码 dayup = 阅读全文
posted @ 2025-03-23 21:28 等雾语 阅读(10) 评论(0) 推荐(0)
摘要: 2.1 点击查看代码 TempStr = input("请输入带有符号的温度值:") if isinstance(TempStr, str) and TempStr[-1] in ['F', 'f']: C = int((float(TempStr[0:-1]) - 32) / 1.8) print 阅读全文
posted @ 2025-03-16 16:11 等雾语 阅读(6) 评论(0) 推荐(0)
摘要: 点击查看代码 str1 = input("请输入一个人的名字:") str2 = input("请输入一个国家名字:") print("世界这么大,{}想去{}看看 .".format(str1,str2)) 点击查看代码 n = input("请输入整数 N:") sum = 0 for i in 阅读全文
posted @ 2025-03-09 22:38 等雾语 阅读(7) 评论(0) 推荐(0)
摘要: 第一次我输入“写一个绘制五星红旗的代码”获得了代码如下,但是它并不能进行正常运行,出现了“AttributeError: 'Screen' object has no attribute 'title' on line 6”这样的错误。 点击查看代码 import turtle # 设置屏幕 scr 阅读全文
posted @ 2025-03-09 21:42 等雾语 阅读(137) 评论(0) 推荐(0)
摘要: 点击查看代码 from turtle import * color('red', 'yellow') begin_fill() while True: forward(200) left(170) if abs(pos()) < 1: break end_fill() done() 阅读全文
posted @ 2025-03-01 17:08 等雾语 阅读(5) 评论(0) 推荐(0)
摘要: 点击查看代码 from turtle import * fillcolor("red") begin_fill() while True: forward(200) right(144) if abs(pos()) < 1: break end_fill() 阅读全文
posted @ 2025-03-01 16:55 等雾语 阅读(8) 评论(0) 推荐(0)
摘要: 点击查看代码 import turtle # 设置屏幕 screen = turtle.Screen() screen.bgcolor("white") screen.setup(width=800, height=600) # 设置窗口大小 # 设置画笔 pen = turtle.Turtle() 阅读全文
posted @ 2025-03-01 16:24 等雾语 阅读(253) 评论(0) 推荐(0)