# Python atan2

The Python atan2 function returns the angle (in radius) from the X-Axis to the specified point (y, x). In this section, we discuss using the atan2 function with an example.

The syntax of the atan2 Function in Python Programming Language is

`math.atan2(y, x);`
• X: It can be a number or a valid numerical expression that represents Cartesian X – Coordinate.
• Y: It can be a number or a valid numerical expression representing Cartesian Y – Coordinate.

HINT: If we pass any non-numeric values to the atan2 Function, then it returns TypeError as output

## Python atan2 Function Example

The atan2 Function in this language returns the angle (in radius) from the X-Axis to the specified point (y, x). In this atan2 example, We are going to find the same with different data types and display the output

TIP: Please refer to the tan article to understand the Python Tangent Function.

```# Example

import math

Tup = (1, 2, 3, -4 , 5)
Lis = [-1, 2, -3.5, -4 , 5]

print('Tangent value of Positive Number = %.2f' %math.atan2(2, 4))
print('Tangent value of Negative Number = %.2f' %math.atan2(-1, 6))

print('Tangent value of Tuple Item = %.2f' %math.atan2(Tup, Tup))
print('Tangent value of List Item = %.2f' %math.atan2(Lis, Lis))

print('Tangent value of Multiple Number = %.2f' %math.atan2(2 + 7 - 4, 9-5))

print('Tangent value of String Number = %.2f', math.atan2('Hello', 'Python'))
```

First, we used the atan2 Function directly on both the Positive integer and negative integer. The following statements find the angle (in radius) for the corresponding values.

```print('Tangent value of Positive Number = %.2f' %math.atan2(2, 4))
print('Tangent value of Negative Number = %.2f' %math.atan2(-1, 6))```

Next, we used the atan2 Function on Tuple and List items. If you see the above screenshot, it is working perfectly on them.

```print('Tangent value of Tuple Item = %.2f' %math.atan2(Tup, Tup))
print('Tangent value of List Item = %.2f' %math.atan2(Lis, Lis))```

Next, we used the math function on multiple values.

`print('Tangent value of Multiple Number = %.2f' %math.atan2(2 + 7 - 4, 9-5))`

Within the last statement, we tried atan2 Function on the string value, and it returns TypeError as output

`print('Tangent value of String Number = %.2f', math.atan2('Hello', 'Python'))`