CS101: Introduction to Programming - Python Code Challenges II - Classes (Advanced) - Typo


2. Using The Superclass

There was an issue discovered when testing the WalkBot prototypes. In some cases, the robots were incorrectly detecting their own legs as obstacles. To overcome this, we need to modify our adjust_sensor method to reset obstacle_found to False and step_length to 5 while also using the original logic from the superclass. Here are the steps:

  1. Override the adjust_sensor method in the WalkBot class by re-defining it in that class.
  2. Call the superclass version of the method within adjust_sensor
  3. Add a line of code to set obstacle_found to False
  4. Add a line of code to set step_length to 5

This section refers to the correct instance variable to be changed: obstacle_found = False
Underneath that it refers to changing: obstacle_count = False

Within the WalkBot class, override the adjust_sensor method to set the obstacle_count instance variable to False and set the step_length to 5 in addition to the the original logic from the superclass.