Newbie question - Advanced math functions available under Windows?

Tim Heaney theaney at cablespeed.com
Fri Jul 2 18:59:13 EDT 2004


The Toad <the.toad at trashcanistan.ca> writes:
>
> The math module documentation says that these math functions are "thin
> wrapers" around the platform C library funtions.  This seems to assume
> a Unix/Linux system platform.
>
> Does this mean that math functions like sqrt(), etc. are not available
> in Python when running on Windows based systems?   Thanks in advance.

No, you just need to import the math module.

  >>> import math
  >>> math.sqrt(10)
  3.1622776601683795

If you want, you can import sqrt into your namespace

  >>> from math import sqrt
  >>> sqrt(10)
  3.1622776601683795

Often, you see people import everything from a module into their
namespace with an asterisk

  >>> from math import *
  >>> sqrt(10)
  3.1622776601683795

I hope this helps,

Tim



More information about the Python-list mailing list