Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in python 3 please show the outputs of the examples thanks. also please comment! A certain robot can perform only 4 types of movement. It
in python 3 please show the outputs of the examples thanks.
also please comment!
A certain robot can perform only 4 types of movement. It can move either up or down or left or right. The movements are represented by 'U', 'D', 'L', 'R'. Each movement is also associated with the number of steps the robot has taken. For example: L 20 mean that the robot has taken 20 steps in the left direction. Write a function named theRound Trip that takes all the movements the robot made in a day as input and output True of bool type if the robot returned to its starting position after its journey. Otherwise, return False. If the input is bad, print the message bad input". Input string will be a comma-separated string of movements: "L 20, R 30, U 40" Explanation: This means that the robot has taken 20 steps to the left, 30 steps to the right and 40 steps in the upward direction in that specific order. The output should be: True OR False OR bad input Examples: Input: L 5, R 10, R 10, L 15 Output: True Input: L5, U 5 Output: False Input: L 5, R 10, P 10, X 2, K5 Output: bad inputStep 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