Reputation: 85
I'm trying to write a program that draws shapes based on user input. I want it to print where each corner of the shape is based on using the turtle.pos()
function, however I'm trying to get the printed output as so:
"The first corner is at: x, y, with a heading of: d."
Currently the print I'm using is
print("The first corner is at:", turtle.position(), "with a heading of:" turtle.heading() + ".")
And this outputs as:
"The first corner is at: (x, y,), with a heading of: d."
So printing the turtle.pos()
returns the coords as a tuple, and prints as (X, y)
. When I try to format as int, it gives me an error about needing str, not vec2d. How would I format that output? Or am I completely going about that the wrong way?
Upvotes: 0
Views: 1742
Reputation: 85
Figured it out- somehow I forgot about
turtle.xcor()/turtle.ycor()
And was able to print those as integers instead.
Upvotes: 2
Reputation: 1414
print("The first corner is at:", turtle.position()[0], "with a heading of:"
turtle.heading() + ".")
Upvotes: -1