Skip to main content

Write a functions to calculate trignometry values



# Function for calculating trignometry values

import math
def cal_sin(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = math.sin(rad)
    print("value of sin function :",val)
def cal_cos(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = math.cos(rad)
    print("value of cos function :",val)
def cal_tan(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = math.tan(rad)
    print("value of tan function :",val)
def cal_cosec(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = 1/math.sin(rad)
    print("value of cosec function :",val)
def cal_sec(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = 1/math.cos(rad)
    print("value of sec function :",val)
def cal_cot(n):
    # Converting degrees to radian
    rad=math.radians(n)
    # holds the actual value of sin(n)
    val = 1/math.tan(rad)
    print("value of cot function :",val)
# Driver Code
n =float(input("Enter value of angle to calculate trignometry values :"))
cal_sin(n)
cal_cos(n)
cal_tan(n)
cal_cosec(n)
cal_sec(n)
cal_cot(n)

Comments