摘要: 4.1 #GuessANumMore.py target = 425 guess = 0 n = 0 while guess != target: guess = eval(input("请输入一个猜测的整数(1至1000):")) n += 1 if guess != target: if gue 阅读全文
posted @ 2025-04-09 00:24 叶柯鑫 阅读(6) 评论(0) 推荐(0)
摘要: s = "Python String" print(s.upper()) print(s.lower()) print(s.find('i')) print(s.replace('ing','gni')) print(s.split(' ')) PYTHON STRING python string 阅读全文
posted @ 2025-03-30 15:46 叶柯鑫 阅读(15) 评论(0) 推荐(0)
摘要: # 假设初始体重为50kg earth_weight = 50 for year in range(1, 11): earth_weight += 0.5 moon_weight = earth_weight * 0.165 print(f"第{year}年的地球体重为{earth_weight:. 阅读全文
posted @ 2025-03-23 20:32 叶柯鑫 阅读(7) 评论(0) 推荐(0)
摘要: # tempConvert.py TempStr = eval(input("请输入华氏温度的温度值:")) C = (TempStr - 32)/1.8 result=int(C) print("转换后的温度是{}C".format(result)) MoneyStr = input("请输入带有 阅读全文
posted @ 2025-03-15 16:56 叶柯鑫 阅读(6) 评论(0) 推荐(0)
摘要: str1 = input("请输入一个人的名字:") str2 = input("请输入一个国家名字:") Print("世界这么大,{ }想去{ }看看.".format (str1,str2)) n = input("请输入整数N:") sum = 0 for i in range (int ( 阅读全文
posted @ 2025-03-09 21:07 叶柯鑫 阅读(15) 评论(0) 推荐(0)
摘要: from turtle import * color('red', 'yellow) begin_fill() while Ture: forward(200) left(170) if abs(pos()) < 1: break end_fill() done() 阅读全文
posted @ 2025-03-09 20:36 叶柯鑫 阅读(10) 评论(0) 推荐(0)
摘要: from turtle import * import time setup(600, 800, 0, 0) speed(0) penup() seth(90) fd(340) seth(0) pendown() # speed(5) begin_fill() fillcolor('red') ci 阅读全文
posted @ 2025-03-09 15:25 叶柯鑫 阅读(12) 评论(0) 推荐(0)
摘要: from turtle import * setup(600, 400, 0, 0) bgcolor('red') done() 以上是绘制红色长方形背景的代码。 from turtle import * def mygoto(x,y): up() goto(x,y) down() color('y 阅读全文
posted @ 2025-03-04 08:23 叶柯鑫 阅读(9) 评论(0) 推荐(0)
摘要: from turtle import * fillcolor("red") begin_fill() while True: forward(200) right(144) if abs(pos()) < 1: break end_fill() 阅读全文
posted @ 2025-02-26 14:03 叶柯鑫 阅读(7) 评论(0) 推荐(0)