Question
IN PYTHON WRITE A PROGRAM: Write a program that allows a user to type an interactive series of commands which would control the turtle. Here
IN PYTHON WRITE A PROGRAM:
Write a program that allows a user to type an interactive series of commands which would control the turtle. Here are the possible commands:
DEG - Sets the number of degrees (N_deg) which will be used for a future turn (Defaults to 90 if not set)
L - Turns left N_deg degrees (defaults to 90 if DEG not previously called)
R - Turns left N_deg degrees (defaults to 90 if DEG not previously called)
DIST - Sets the distance in pixels (N_dist) which will be used for a future F (forward command) (Defaults to 10 if not set)
F - Moves the turtle forward N_dist number of pixels (Defaults to 10)
RED - Sets the pen to red
BLUE - Sets the pen to blue
GREEN - Sets the pen to green
BLACK - Set the pen to black (the default)
UP - Picks the pen up
DOWN - Puts the pen down
Q - Quits the program
Note that each one of these commands should call its own Function (Def). In the case of te F, L, and R commands, those functions should be sent a parameter indicating the distance or the number of degrees.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started