You are standing at a distance d from a tower of height h. Given either the distance to the tower or height of the tower and the angle of elevation to the top of the tower from the point where you are standing (in degrees), find the rounded down value of the missing variable, i.e if the height is given, you need to find the distance or vice-versa.
Character ' d ' is given if distance is given otherwise character ' h ' is given in input.
Example 1:
Input:
Type = 'd'
Value = 12
Angle of elevation = 67
Output:
28
Explanation:
The height is 28 (rounded down) if the 
distance is 12 and the angle of elevation 
is 67 i.e Tan(67^{o}) ≈ 28 / 12.
Example 2:
Input:
Type = 'h'
Value = 100
Angle of elevation = 66
Output:
44
Explanation:
The distance is 44 (rounded down) when the
height is 100 and the angle of elevation 
is 66 i.e Tan(66^{o}) ≈ 100 / 44.
Your Task:
You don't need to read input or print anything. Your task is to complete the function findHeightOrDistance() which takes a character called type and two numbers value and angle as input parameters and returns the value of the missing variable (rounded down). 
Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)
Constraints:
Type = 'h' or 'd'
1 ≤ value(height or distance) ≤ 1000
4 ≤ angle ≤ 89

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3

class Solution:
    def findHeightOrDistance(self, type, value, angle):
        #code here

Solutions:
import math

class Solution:

	def findHeightOrDistance(self, type, value, angle):
		if type == 'h':
			ans = value / math.tan(angle * 3.14 / 180)
		else:
			ans = value * math.tan(angle * 3.14 / 180)
		return math.floor(ans)


from math import tan

class Solution:

	def findHeightOrDistance(self, type, value, angle):
		if type == 'h':
			return int(value / tan(angle * (3.14 / 180)))
		else:
			return int(value * tan(angle * (3.14 / 180)))


import math

class Solution:

	def findHeightOrDistance(self, type, value, angle):
		angle = angle * (3.14 / 180)
		x = math.tan(angle)
		if type == 'd':
			return int(x * value)
		else:
			return int(value / x)


class Solution:

	def findHeightOrDistance(self, type, value, angle):
		if type == 'h':
			r = value / math.tan(angle * 3.14 / 180.0)
		else:
			r = value * math.tan(angle * 3.14 / 180.0)
		return int(r)
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		(ch, a, b) = map(str, input().strip().split())
		a = float(a)
		b = float(b)
		ob = Solution()
		print(ob.findHeightOrDistance(ch, a, b))