生日快乐python程序编码_如何用Python编写一个很炫的生日快乐的程序?

import turtle

import random

# set the background color for the page

bg = turtle.Screen()

bg.bgcolor("light blue")

tommy = turtle.Turtle()

tommy.shape("turtle")

tommy.speed(75)

# draw lines

tommy.penup()

tommy.goto(-190, -180)

tommy.color("yellow")

tommy.pensize(6)

tommy.pendown()

tommy.goto(190,-180)

tommy.penup()

tommy.penup()

tommy.goto(-160, -150)

tommy.color("purple")

tommy.pensize(6)

tommy.pendown()

tommy.goto(160,-150)

tommy.penup()

tommy.penup()

tommy.goto(-130, -120)

tommy.color("teal")

tommy.pensize(6)

tommy.pendown()

tommy.goto(130,-120)

tommy.penup()

# draw cake

tommy.goto(-74,-110)

tommy.pendown()

tom

你可能感兴趣的:(生日快乐python程序编码)