Tatoandropadz
Tatoandropadz

Reputation: 13

how to output a variable on turtle screen?

I am trying to output a variable with text in turtle but it always outputs the wrong thing im trying to write "point 1 (100, 100) where x1 = 100, y1 = 100

#writing the text
turtle.goto(point1)
turtle.write("point 1 (",x1",",y1,")")

Upvotes: 0

Views: 837

Answers (1)

Abhyuday Vaish
Abhyuday Vaish

Reputation: 2379

You manipulated the quotation marks a bit wrongly. Try using f-strings:

turtle.write(f"point 1 ({x1}, {y1})")

Upvotes: 1

Related Questions