Degrees to radians

Python, Math · Nov 2, 2020

Converts an angle from degrees to radians.

  • Use math.pi and the degrees to radians formula to convert the angle from degrees to radians.
from math import pi

def degrees_to_rads(deg):
  return (deg * pi) / 180.0
degrees_to_rads(180) # ~3.1416

More like this

  • Radians to degrees

    Converts an angle from radians to degrees.

    Python, Math · Nov 2, 2020

  • Integer to roman numeral

    Converts an integer to its roman numeral representation. Accepts value between 1 and 3999 (both inclusive).

    Python, Math · Nov 2, 2020

  • Digitize number

    Converts a number to a list of digits.

    Python, Math · Sep 15, 2020