Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
My program is not doing what it's supposed to be doing:
My program is not doing what it's supposed to be doing: If turtle's x coordinate is >= 250 or turtle's x coordinate is <= -250 or
turtle's y coordinate is >= 250 or turtle's y coordinate is <= -250
Move turtle -5px (back on screen)
Get a new random number between 0 and 360
Set turtle's direction to the new random number.
Here is my code:
import turtle
import random
#initalize window
win = turtle.Screen()
print("Default Screen Size")#sets screne size
win.bgcolor("indigo") # sets the background color
win.title ("bounce") #title of screne
win.setup(500,500)#sets costom window size
#create turtle object
jack = turtle.Turtle()
# use a turtle image to represent jack
jack.shape("turtle")
jack.color("black")
jack.pendown()
jack.forward(5)
while True :# jack is range (-250,250):
jack.forward(5)
if jack.xcor()>= (250) or jack.xcor()<=(-250):
jack.backward(-5)
jack.right(random.randint(1,360))
elif jack.ycor()>=(250 ) or jack.ycor()<=(-250):
jack.backward(-5)
jack.right(random.randint(1,360))