Ask your own question, for FREE!
Computer Science 10 Online
Aqual:

Is there a way to create a variable as the name of the turtle in Python so that I can make the design a function?

Aqual:

@dude

BrianaGatica2006:

Nah I don't think so.

BrianaGatica2006:

tbh I don't even know

Aqual:

figured it out.

Aqual:

import turtle def tree(turtle): turtle.begin_fill() turtle.speed(100) turtle.right(45) turtle.forward(71) turtle.right(135) for i in range(2): turtle.forward(25) turtle.left(135) turtle.forward(71) turtle.right(135) turtle.forward(200) for i in range(2): turtle.right(135) turtle.forward(71) turtle.left(135) turtle.forward(25) turtle.right(135) turtle.forward(71) turtle.end_fill() turtle.penup() turtle.right(135) turtle.forward(150) turtle.color("brown") turtle.pendown() turtle.begin_fill() turtle.left(90) turtle.forward(25) turtle.right(90) turtle.forward(75) turtle.right(90) turtle.forward(50) turtle.right(90) turtle.forward(75) turtle.right(90) turtle.forward(25) turtle.end_fill() def main(): jack = turtle.Turtle() jack.hideturtle() jack.color("green") jack.penup() jack.setposition(0, 75) jack.pendown() tree(jack) pack = turtle.Turtle() pack.hideturtle() pack.color("yellow") pack.penup() pack.setposition(200, 0) pack.pendown() tree(pack) tack = turtle.Turtle() tack.hideturtle() tack.color("red") tack.penup() tack.setposition(123, 225) pack.pendown() tree(tack) sack = turtle.Turtle() sack.hideturtle() sack.color("aqua") sack.penup() sack.setposition(450, 78) sack.pendown() tree(sack) main()

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!