The most common answer is:

```
speed(5)
pensize(10)
Draws a lime checkmark
def checkmark():
color(“lime”)
right(45)
forward(25)
left(90)
forward(75)
This draws a happy arrow
def happyarrow():
left(90)
forward(100)
right(135)
forward(50)
backward(50)
left(270)
forward(50)
This makes it a sad arrow! 🙁
def sadarrow():
right(180)
happyarrow()
Defines the user number and secret number
user_number = int(input(“Guess a number from (1-10)…Remember, your choice doesn’t matter unless you get it right:”))
secret_number = 3
while user_number != secret_number:
user_number = int(input(“Guess a number from (1-10)…again:”))
if user_number > secret_number:
color(“Navy”)
sadarrow()
clear()
penup()
setposition(0,0)
right(45)
pendown()
elif user_number < secret_number:
color(“yellow”)
happyarrow()
clear()
penup()
setposition(0,0)
right(225)
pendown()
if user_number == secret_number:
print(“You win!!!!!! Yay!!!”)
penup()
setposition(0,0)
pendown()
checkmark()
```

To create a Python turtle graphics program where a user guesses a number and receives visual feedback in the form of a happy arrow for guesses lower than the secret number, a sad arrow for guesses higher than the secret number, and a lime checkmark for the correct guess, we need to ensure that the turtle graphics setup is correct and that the logic for comparing the user’s guess to the secret number works as intended.

Let’s also make sure to correct the syntax for string literals and organize the control flow for a more streamlined user experience:

```
import turtle
turtle.speed(5)
turtle.pensize(10)
# Draws a lime checkmark
def checkmark():
turtle.color("lime")
turtle.right(45)
turtle.forward(25)
turtle.left(90)
turtle.forward(75)
# This draws a happy arrow
def happyarrow():
turtle.left(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(50)
turtle.backward(50)
turtle.left(270)
turtle.forward(50)
# This makes it a sad arrow!
def sadarrow():
turtle.right(180)
happyarrow()
# Clear drawing without moving the turtle
def clear_drawing():
turtle.clear()
turtle.penup()
turtle.setposition(0,0)
turtle.pendown()
# Defines the user number and secret number
secret_number = 3
user_number = int(input("Guess a number from (1-10)…Remember, your choice doesn’t matter unless you get it right: "))
while user_number != secret_number:
if user_number > secret_number:
turtle.color("Navy")
sadarrow()
clear_drawing()
elif user_number < secret_number:
turtle.color("yellow")
happyarrow()
clear_drawing()
user_number = int(input("Guess a number from (1-10)…again: "))
print("You win!!!!!! Yay!!!")
checkmark()
turtle.done()
```

This script first defines functions for drawing a checkmark, a happy arrow, and a sad arrow. It then prompts the user to guess a number, providing visual feedback for each guess: a sad arrow if the guess is too high (colored in “Navy”), a happy arrow if the guess is too low (colored in “yellow”), and a lime checkmark for the correct guess. After each incorrect guess, the drawing is cleared, and the turtle’s position is reset before drawing the next arrow.

## Leave a comment