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

Syntax:
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.

ExampleEdit & Run
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)
Output:
0.643501108793284436.86989764584402[Finished in 0.011050488101318479s]

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

ExampleEdit & Run
import math

print(math.atan2(2, 3))
print(math.atan2(1, 2))
print(math.atan2(5, 5))
Output:
0.58800260354756750.46364760900080610.7853981633974483[Finished in 0.01057771104387939s]