create text on the screen saying hi how are you using turtle in python

main.py
import turtle

# create turtle object
t = turtle.Turtle()

# move the turtle to a position where we start to write text
t.penup()
t.goto(-50, 50)

# write the text
t.write("Hi, how are you?", font=("Arial", 16, "normal"))

# hide the turtle
t.hideturtle()

# keep the window open until closed manually
turtle.done()
316 chars
18 lines

In this code, we first import the turtle module and create a turtle object. Then, we use the penup() method to lift the turtle's pen so that it doesn't draw as it moves to a starting position for the text. We set the position to (-50, 50) with the goto() method.

Next, we use the write() method to write the text "Hi, how are you?" with a specified font.

Finally, we use the hideturtle() method to hide the turtle's appearance, and the turtle.done() function to keep the window open until it is manually closed.

gistlibby LogSnag