How to compare 3 laser functions and find biggest

#this is gonna be used for the bigger project, i want to compare laser functions from the 3 directions and find whichever ever side with the most space and then move in that direction. it keeps telling me the a, b, c are not defined and just not working

from robot_control_class import RobotControl

l = RobotControl()

class test_for:

    def maximum(a, b, c):

        l = self.rc.get_laser_full()

        a = l[0]

        b = l[360]

        c = l[719]

        if (a >= b) and (a >= c):

            largest = a

  

        elif (b >= a) and (b >= c):

            largest = b

        else:

            largest = c

          

        return largest

    print(maximum(a, b, c))

Tr = test_for()

Tr.maximum()

Hi @Andrew1203 ,

This error is happening because the “print(maximum(a, b, c))” code is not inside the def maximum(a, b, c) method, therefore it cannot see the variables defined inside that method.

If you put “print(maximum(a, b, c))” before return largest in the def maximum(a, b, c) method, it should work.

It could also be something like:

from robot_control_class import RobotControl

l = RobotControl()

class test_for:

    def maximum(a, b, c):

        l = self.rc.get_laser_full()

        a = l[0]

        b = l[360]

        c = l[719]

        if (a >= b) and (a >= c):

            largest = a

  

        elif (b >= a) and (b >= c):

            largest = b

        else:

            largest = c


        print((a, b, c, largest))
          

        return largest



Tr = test_for()

Tr.maximum()