The math.atan2() function returns the arc tangent (inverse tangent) of a ratio of two values, y and x.

math.atan2(y, x)

Where is the numerator and is the denominator of the ratio whose arc tangent we want. The function evaluates and returns the inverse tangent of y/x in radians.

import math

angle_in_rad = math.atan2(3, 4)
print(angle_in_rad)
angle_in_deg = math.degrees(angle_in_rad)
print(angle_in_deg)

The math.degrees function, as shown above, converts an angle from radians to degrees.

import math

print(math.atan2(2, 3))
print(math.atan2(1, 2))
print(math.atan2(5, 5))