We create a menu-controllable turtle program that uses if…elif…else and an infinite “while True” loop to make interesting patterns.
# Start with a blank file
from turtle import *
print("Welcome to my menu-turtle.".center(60))
while True:
print("""\nEnter a command to continue:
fd - Go forward
rt - turn right
lt - turn left
c - make a circle
\n""")
strChoice = input("What do you want to do?")
if (strChoice == "fd"):
forward(50)
elif (strChoice == "rt"):
right(90)
elif (strChoice == "lt"):
left(90)
elif (strChoice == "c"):
circle(100)
else:
print("That command isn't valid.")