Is it possible to make Python turtle goto a position within parameters

Viewed 28

For a project I need to use the goto command alot and for something like trees I only want the turtle to goto to between certain coords for example I only want it to draw a tree within (300,0) and (500,100)

1 Answers

If you want to go to random positions between (300, 0) (500,100), you can use randrange for the coordinates. Here is a simple tutorial: https://www.geeksforgeeks.org/randrange-in-python/

If you meant you were trying to give parameters as value you can use this:

x = 100
y = 250

goto(x,y)

I hope that this is what you meant.

Related