- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python program to find angle between mid-point and base of a right angled triangle
Suppose we have two sides of a right angled triangle, these sides are AB and BC. Consider the midpoint of hypotenuse AC is M. We have to find the angle between M and BC.
So, if the input is like ab = 6 bc = 4, then the output will be 56.309932474020215 because arc_tan of ab/bc is 0.9828 but in degrees it is 56.31.
To solve this, we will follow these steps −
- ans := arc-tan(ab/bc)
- return ans in degrees
Example
Let us see the following implementation to get better understanding
from math import atan, pi def solve(ab, bc): def deg(rad): return 180/pi * rad ans = deg(atan(ab/bc)) return ans ab = 6 bc = 4 print(solve(ab, bc))
Input
6, 4
Output
45.0
Advertisements