Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is a problem that when I submit, it said: Environment is: [['r', 'd', 'c', 'd', 'c', 'c', 'c'], ['d', 'c', 'c', 'c', 'd', 'd',

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Here is a problem that when I submit, it said:

Environment is: [['r', 'd', 'c', 'd', 'c', 'c', 'c'], ['d', 'c', 'c', 'c', 'd', 'd', 'd'], ['c', 'c', 'd', 'd', 'c', 'c', 'c'], ['d', 'd', 'd', 'd', 'd', 'd', 'd']]

ToClean(environ) incorrectly returned ['right', 'clean', 'right', 'right', 'clean', 'left', 'left', 'left', 'down', 'clean', 'right', 'right', 'right', 'right', 'clean', 'right', 'clean', 'right', 'clean', 'left', 'left', 'left', 'left', 'left', 'left', 'down', 'right', 'right', 'clean', 'right', 'clean', 'left', 'left', 'left', 'down', 'clean', 'right', 'clean', 'right', 'clean', 'right', 'clean', 'right', 'clean', 'right', 'clean', 'right', 'clean']image text in transcribed

Then the output would be ['right', 'clean', 'right','right', 'clean', 'left', 'left', 'left', 'down', 'clean', 'right', right', 'right', 'right', 'clean' Hint: The Roomba always starts in the upper left corner HINT: Get the locations of the dirty spaces first, then loop through those to decide the Roomba's actions HINT : Use the location of the Roomba in relation to the dirty space locations to decide the actions HINT: You should not modify the input lists to get the actions. Simply make variables to reference the locations in the input lists. LAB ACTIVITY 5.14.1: Roboticist 0/3 main.py Load default template... 1 def create_listO 2 inp str-input) lista ist(inp str) return 1ista 4 um 1stint(input)) for i in range(num_1ist): name-V' +str(1) locals()['v+str(i)]-i 11 print(name) def create-list(): # Takes user input and returns list of chars inp-str input() # Asks user input for d','c','r' lista list(inp-str) # converts string to list return lista # returns list of characters def Toclean (environ): actions [] # list to store all the roomba actions len-of-environs len(environ) # storing len of environments to take take decision while going "down" present-environ # To keep track of present environment for ind-environ in environ: # loop for individual environment if present-environ-0: # if present environment is not the first one go "down actions.append("down..) # adding action "down" to actions present-environ - present-environ + 1 # changing track of present environment roomba-location # to keep track of robo location dirty-locations [ for i, x in enumerate(ind-environ) f x-"d"] # collect all dirty locations for dirt loc in dirty locations: # loop for all dirty locations if roomba-location dirt-loc: # if robo is behind dirty location for in range (dirt loc - roomba location): # take no of actions to reach dirty location actions.append("right") : Compare output 2 Input rdcdc dcccd ['right', 'clean','right', 'right', 'clean', 'left', 'left', 'left', 'd Your output 2: Unit test Environment is: Test feedback [l'r', 'd',. Toclean (environ) incorrectly returned ['right', 'clean', 'right', 'right

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions