Skip to content

Commit 3b5eb3c

Browse files
authored
Create trigonometric_ratios.py
A Python script to calculate the trigonometric ratios.
1 parent 3a1225b commit 3b5eb3c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Math/trigonometric_ratios.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import math
2+
3+
print("Enter the values of sides of a triangle")
4+
a = float(input("Enter the value of side a: "))
5+
b = float(input("Enter the value of side b: "))
6+
c = float(input("Enter the value of side c: "))
7+
8+
# Calculating the values of sin, cos and tan
9+
sin_a = round((a / c), 2)
10+
cos_a = round((b / c), 2)
11+
tan_a = round((a / b), 2)
12+
13+
# Calculating the values of cosec, sec and cot
14+
cosec_a = round((1 / sin_a), 2)
15+
sec_a = round((1 / cos_a), 2)
16+
cot_a = round((1 / tan_a), 2)
17+
18+
# Printing the values of sin, cos and tan
19+
print("\nThe value of sin a is: ", sin_a)
20+
print("The value of cos a is: ", cos_a)
21+
print("The value of tan a is: ", tan_a)
22+
23+
# Printing the values of cosec, sec and cot
24+
print("The value of cosec a is: ", cosec_a)
25+
print("The value of sec a is: ", sec_a)
26+
print("The value of cot a is: ", cot_a)
27+
28+
29+
# Defining the formula of Heron's to calculate the area of triangle.
30+
def Area(a, b, c):
31+
sp = (a + b + c) / 2
32+
area = (sp) * (sp - a) * (sp - b) * (sp - c)
33+
f_area = round((area**0.5), 2)
34+
print(f"The area of triangle is {f_area}" + " square units")
35+
36+
37+
# Printing the area of triangle.
38+
Area(a, b, c)

0 commit comments

Comments
 (0)