Question: Using the function get_move() written above (in part a), and the following variable definition: robot_pos = 5 Write program that will call function get_move() ten

Using the function get_move() written above (in part a), and the following variable definition:

robot_pos = 5

Write program that will call function get_move() ten times in order to simulate moving a robot.If the function call to get_move() returns the string 'forward', display the text 'Forward' to the screen and increment the robot's position (robot_pos) by two.Display the updated position of the robot to the screen.If the function returns the string 'backward', display the text 'Backward' to the screen and decrement the robot's position (robot_pos) by one and display the updated position to the screen.If the function returns string 'stay', display the text 'Stay' to the screen and do not update the robot's position (robot_pos).YouMUSTcall the function get_move() from within a loop and update robot_pos from within the loop.The loop will stop looping when either, it has looped ten times, the robot reaches zero or the robot reaches ten.Display how many times the robot moved to the screen and the robot's starting position.If the loop looped ten times, display the text 'Robot failed to reach destination!' to the screen.If robot_pos is zero, display the text 'Robot took a turn for the worse!' to the screen.If robot_pos is ten, display the text 'Robot reached destination!' to the screen.

If you didn't complete part a), you may assume that you did in order to answer this question.

For example:

Sample output as follows:

Robot starting at:5

Forward 7

Stay 7

Stay 7

Backward 6

Forward 8

Forward 10

Robot moved 6 times:)

Robot reached destination!

Sample output as follows:

Robot starting at:5

Stay 5

Forward 7

Stay 7

Backward 6

Forward 8

Stay 8

Backward 7

Stay 7

Stay 7

Forward 9

Robot moved 10 times:)

Robot failed to reach destination!

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 Programming Questions!