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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!