In this HackerRank Find Angle MBC problem solution in python, Point M is the midpoint of hypotenuse AC. You are given the lengths AB and BC. Your task is to find ∠MBC (angle 0°, as shown in the figure) in degrees.
Problem solution in Python 2 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math ab = float(raw_input()) bc = float(raw_input()) tang = ab / bc rad = math.atan(tang) print '{}°'.format(int(round(math.degrees(rad))))
Problem solution in Python 3 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math a = int(input()) b = int(input()) M = math.sqrt(a**2+b**2) theta = math.acos(b/M ) print(str(round(math.degrees(theta)))+'°')
Problem solution in pypy programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math n = input() m = input() print str(int(round(math.degrees(math.atan2(n,m))))) + u'N{DEGREE SIGN}'
Problem solution in pypy3 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math AB = float(input()) BC = float(input()) print(str(int(round(math.degrees(math.atan2(AB, BC)))))+'°')