Professional Documents
Culture Documents
Bài 1:
import turtle
# Vẽ hình trụ bát giác với 6 cạnh và kích thước mặt cạnh là 50, chiều cao là 100
draw_cone(6, 50, 100)
# Hàm để vẽ ellipse
def draw_ellipse(a, b):
t.penup()
t.goto(a, 0)
t.pendown()
t.speed(0)
for _ in range(2):
t.circle(a, 90)
t.circle(b, 90)
# Vẽ ellipse
draw_ellipse(30, 20)
# Quay ellipse
rotate_ellipse(45)
pygame.display.flip()
pygame.time.wait(10)
BT trên lớp: