Quote:
|
Originally Posted by Dietrich
There are several ways to use import, here is one example:
[php]
# math sqrt()
import math
print "\nSquare root of integer formatted as float with 4 decimals:"
for value in range(10):
squareRoot = math.sqrt(value)
print "sqrt(%d) = %.4f" % (value, squareRoot)
[/php]
The squareroot function is in module math. Notice how we used math.sqrt(value) to tie the two together. You can avoid the math prefix by using:
from math import sqrt
or if you use several other math functions:
from math import *
|
ok you cofused me on that
cause im jut a beginer
i guess i know y i havent learned the import just yet :o