1.第一个题目 画五环
import turtle as t
t.setup(700,400)
t.penup()
t.goto(-80,0)
t.pendown()
t.pencolor("blue")
t.pensize(3)
t.circle(50
)t.penup()
t.goto(0,0)
t.pendown()
t.pencolor("black")
t.pensize(3)
t.circle(50)
t.penup()
t.goto(80,0)
t.pendown()
t.pencolor("red")
t.pensize(3)
t.circle(50)
t.penup()
t.goto(-40,-80)
t.pendown()
t.pencolor("yellow")
t.pensize(3)
t.circle(50)
t.penup()
t.goto(40,-80)
t.pendown()
t.pencolor("green")
t.pensize(3)
t.circle(50)
t.done()
2.第二题demo2
r = float(input("Enter the radius of a cylinder= ")) l = float(input("Enter the length of a cylinder= ")) import math Π = math.pi area = r * r * Π volume = area * l print(f"The area is {area} ") print(f"The volume is {volume}")
3.第三题demo5
M = float(input("Enter the amount of water in kilograms :")) I = float(input("Enter the initial temperature :")) F = float(input("Enter the final temperature :")) Q = M * (F - I) * 4184 print(f"The energe needed is:{Q}")
4.第四题demo25
T = int(input("Enter today's day :")) E = int(input("Enter the number of days elapsed since today :")) F = (T + E % 7) print(f"Today is {T} and the future day is {F}")