It says "Python Task 3: main method DID NOT work correctly" task3.py error

I wrote the code like that it works perfectly when I run it but the bot didn’t let me the finish the exam
The full error :
:heavy_multiplication_x: [19:58:32] [assess] Python Task 3: main method DID NOT work correctly
Check:

  • Adjust the Python script task3.py according to the instructions and specifications (mark: 9.00)
    from robot_control_class import RobotControl

class ExamControl:
def init(self):
self.rc = RobotControl()

def get_laser_readings(self):
    left_reading = self.rc.get_laser(719) 
    right_reading = self.rc.get_laser(0)  
    return left_reading, right_reading

def main(self):
    self.rc.move_straight()  
    
    while True:
        left_reading, right_reading = self.get_laser_readings()

        if left_reading > 1.5 and right_reading > 1.5:  
            print("No obstacles detected. Stopping the robot.")
            self.rc.stop_robot()  
            break
        else:
            print("Obstacle detected! Continuing to move forward.")

if name == “main”:
ExamControl().main()

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.