**the code below uses 6 functions and approximantly every function uses t. goto
is there any other function I can use to replace it? (similar functions that give the same output)**strong text**
----------**
the requirement for the project was to use at least 5 functions
import turtle as t
def drawhat():
t.speed(15)
t.fillcolor("black")
t.begin_fill()
t.penup()
t.goto(0,250)
t.pendown()
t.left(180)
t.forward(60)
t.left(90)
t.forward(50)
t.right(90)
t.forward(30)
t.left(90)
t.forward(20)
t.left(90)
t.forward(120)
t.left(90)
t.forward(20)
t.left(90)
t.forward(30)
t.right(90)
t.forward(50)
t.end_fill()
most of the commands used in the code are very repetitive
def drawhead():
t.speed(15)
#head
t.penup()
t.goto(20,150)
t.pendown()
t.circle(50)
#eyes
t.fillcolor("blue")
t.begin_fill()
t.penup()
t.goto(0,155)
t.pendown()
t.circle(5)
t.end_fill()
t.fillcolor("red")
t.begin_fill()
t.penup()
t.goto(-50, 155)
t.pendown()
t.circle(5)
t.end_fill()
#mouth
t.penup()
t.goto(0,120)
t.pendown()
t.left(90)
t.forward(60)
def midsection():
t.penup()
t.goto(-20,100)
t.pendown()
t.circle(75)
def drawarms():
t.penup()
t.goto(40,65)
t.pendown()
t.right(150)
t.forward(60)
t.left(30)
t.forward(15)
t.penup()
t.goto(85,90)
t.pendown()
t.forward(25)
t.penup()
t.goto(-90,55)
t.pendown()
t.left(60)
t.forward(50)
t.left(30)
t.forward(25)
t.penup()
t.goto(-10,20)
t.pendown()
is there a command where the pen would stay the in the same location and have the same outcome without using the turtle.goto function
def arm2():
t.penup()
t.goto(-120,100)
t.pendown()
t.right(30)
t.forward(25)
def base():
t.penup()
t.goto(60,-100)
t.pendown()
t.circle(100)
as you can see they code has the same pattern first penup, then goto, and then pendown
(calling all the functions):
drawhat()
drawhead()
midsection()
drawarms()
arm2()
base()