Given a 90 degree angle, print the bisecting angle in degrees.
import math
#given angle
abc = 90
#m is midpoint of ac, therefor
abm = abc/2
mbc = abc - abm
degrees = math.degrees(mbc)
print(degrees)
but when I print it out, i get 2578.3100780887044
if I don't use math.degrees() then I get:
mbc = abc - abm
#degrees = math.degrees(mbc)
print(mbc)
45.0
but what I need is: 45°
I found math.radians() and math.degrees() but I feel like there is something I am missing. Any help?
Python 3 returns a float for every integer or float division. If you want you can floor the result writing: abm = int(abc/2)
. This will give you mbc as an integer.
On the other hand, math.degrees()
converts an angle from radians to degrees, giving a float as a result. If you want to floor the result of the conversion you can do degrees = int(math.degrees(mbc))
.