Chalarangelo / 30-seconds-of-python

Short Python code snippets for all your development needs
https://www.30secondsofcode.org/python/p/1
Creative Commons Attribution 4.0 International
8.83k stars 1.26k forks source link

fix bug in rads_to_degrees.md #414

Closed zhangfelix closed 4 years ago

zhangfelix commented 4 years ago

The first line is "from math import pi", but use "math.pi" in the following function.

Delete the "import" statement for the example.

Before

from math import pi

def rads_to_degrees(rad):
  return (rad * 180.0) / math.pi
from math import pi
rads_to_degrees(math.pi / 2) # 90.0

After

from math import pi

def rads_to_degrees(rad):
  return (rad * 180.0) / pi
rads_to_degrees(pi / 2) # 90.0
Trinityyi commented 4 years ago

This has already been fixed in the content curation epic. Thanks.