#Use the math.tan function

#Import the math module
import math

#Call the math.tan function
print(math.tan(math.radians(30)))

The math.tan() function returns the tangent of a value given in radians. This function takes a single parameter (x) and returns the tangent of the angle as a floating point number.

math.tan(x) 

Where is the  angle(in radians), whose tangent we want.

The function returns the tangent of x.   

import math

degree_angle = 20

radian_angle = math.radians(degree_angle)

print('The tangent of {} is {}'.format(degree_angle, math.tan(radian_angle)))

The math.radians() function takes an angle in degrees and returns its value in radians.

import math
math.tan(math.radians(30))
//0.5773502691896257
math.tan(math.radians(45))
//0.9999999999999999
math.tan(math.radians(50))
//1.19175359259421
math.tan(math.radians(80))
//5.671281819617707
math.tan(math.radians(120))
//-1.7320508075688783