I keep getting this error of an infinite loop

Hello , I am currently doing my final exam on the ros foundation but i keep getting this error for my task 3

:heavy_multiplication_x: [14:05:18] [warn] Grading has taken longer than expected. Aborting…
Things you can check:

  • Infinite loops within your code
  • Logic within you code taking longer than specified

Please try again and contact us if the problem persists. (mark: 9.00)

This is the code:

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):
    # Start moving the robot forward
    self.rc.move_straight()

    while True:
        left_reading, right_reading = self.get_laser_readings()

        # If there are no obstacles on either side, stop the robot
        if left_reading > 100 and right_reading > 100:
            self.rc.stop_robot()
            break

i fill like its something so basic that i just cant seem to see. Could someone please help me.

And also i thought 9/10 would give me a pass in the exam but it seems i cant mark my exam as done and when i go to my learning path to check for my scores they are still 0 and no certificate. Please help

The problem seems to be somewhere in your ExamControl class main method.

Create and execute the following Python script in the same location where you have your task3.py file, and show us the output.

from task3 import ExamControl

ec = ExamControl()
ec.main()
lf = ec.get_laser_readings()
print(lf)

This is the output
user:~$ cd ~/catkin_ws/src/python_exam
user:~/catkin_ws/src/python_exam$ python task2.py
user:~/catkin_ws/src/python_exam$ python task3.py(inf, inf)

I mean you should create another file, say test_scripts.py in the same location where you have task3.py, copy the code and paste it that file. Then, execute:

cd ~/catkin_ws/src/python_exam
python test_scripts.py

Show the full output of those commands in the web shell. You can take a screenshot of the web shell, or copy/paste the output here.