Code not working

This code is not working for Prerequisites Exam ( Code Foundation Course)
Please can you solve this

Hi @Syeda_Zoya ,

Welcome to the Community!

From your code, I can understand that your robot will move straight until left and right ranges are infinity and then stop. I believe that your robot is hitting the wall and stopping? You are not stopping your robot before the wall.
You must do in the following way:

  1. Move robot straight upto the wall and stop in front the wall.
  2. Turn direction by rotating the robot.
  3. Then move straight to the exit while checking for infinity values.

The code in your case will not work as you are not calling the main() function.

Uncomment your ec.main() function.


1 Like

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