-- coding: utf-8 --
"""
Created on Mon Mar 17 10:44:01 2025
@author: ASUS
"""
TempConvert.py
TempStr = eval(input("请输入温度值:"))
Fuhao = input("请输入对应温度的符号:")
if Fuhao in ['F','f']:
C = (TempStr-32)/1.8
print("转换后的温度是{:.0f}C".format(int(round(C))))
elif Fuhao in ['C','c']:
F = 1.8*TempStr+ 32
print("转换后的温度是{:.0f}F".format(int(round(F))))
else:
print("输入格式错误")
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:45:01 2025
@author: ASUS
"""
TempConvert.py
Jiner = input("请输入带有符号的金额:")
if Jiner[-1] == '$':
Renmingbi = eval(Jiner[0:-1])*6
print("转换后的金额是{:.2f}¥".format(Renmingbi))
elif Jiner[-1] == '¥':
Meiyuan = eval(Jiner[0:-1])/6
print("转换后的金额是{:.2f}F".format(Meiyuan))
else:
print("输入格式错误")
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:45:40 2025
@author: ASUS
"""
Zhongliang = input("请输入带有符号的重量:")
if Zhongliang[-1] in ['g','G']:
Bang = eval(Zhongliang[0:-2])*2.2046
print("转换后的重量是{:.4f}LB".format(Bang))
elif Zhongliang[-1] in ['b','B']:
Gongjin = eval(Zhongliang[0:-2])/2.2046
print("转换后的金额是{:.4f}KG".format(Gongjin))
else:
print("输入格式错误")
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:46:20 2025
@author: ASUS
"""
DrawColorfulPython.py
import turtle
定义颜色列表(可根据需要调整颜色顺序)
colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
turtle.setup(650, 350, 200, 200)
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(25)
turtle.seth(-40)
循环绘制彩色蟒蛇
for i in range(4):
# 设置当前颜色(循环取色)
turtle.pencolor(colors[i % len(colors)])
turtle.circle(40, 80)
turtle.circle(-40, 80)
绘制蟒蛇头部
turtle.pencolor(colors[4 % len(colors)])
turtle.circle(40, 80/2)
turtle.pencolor(colors[5 % len(colors)])
turtle.fd(40)
turtle.pencolor(colors[6 % len(colors)])
turtle.circle(16, 180)
turtle.pencolor(colors[0 % len(colors)])
turtle.fd(40 * 2/3)
turtle.done()
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:46:48 2025
@author: ASUS
"""
DrawPython.py
import turtle
turtle.setup(500.500)
turtle.fd(100)
turtle.left(120)
turtle.fd(100)
turtle.left(120)
turtle.fd(100)
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:47:00 2025
@author: ASUS
"""
DrawPython.py
import turtle
turtle.setup(500.500)
turtle.fd(100)
turtle.left(120)
turtle.fd(100)
turtle.left(120)
turtle.fd(100)
turtle.left(120)
turtle.fd(50)
turtle.left(60)
turtle.fd(50)
turtle.left(120)
turtle.fd(50)
turtle.left(120)
turtle.fd(50)
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:47:13 2025
@author: ASUS
"""
DrawPython.py
import turtle
turtle.setup(500.500)
turtle.left(30)
turtle.fd(180)
turtle.right(120)
turtle.fd(270)
turtle.right(120)
turtle.fd(270)
turtle.right(120)
turtle.fd(90)
turtle.left(60)
turtle.fd(90)
turtle.right(120)
turtle.fd(270)
turtle.right(120)
turtle.fd(270)
turtle.right(120)
turtle.fd(180)
turtle.done()
-- coding: utf-8 --
"""
Created on Mon Mar 17 10:47:22 2025
@author: ASUS
"""
import turtle
pen = turtle.Turtle()
pen.speed(0)
step = 10
for _ in range(50):
pen.forward(step)
pen.right(90)
pen.forward(step)
pen.right(90)
step += 10
turtle.done()