# 2014-01-24 Library Functions
# Libraries are groups of functions
# and is a commonly used description
# across languages
# Python calls their libraries "modules"
# and these modules also include
# constant values, such as pi
# We don't use modules by default
# because they would make our programs
# much larger. We choose when we
# need them and we put a special line
# in our programs to "import" these
# modules
# If your program requires a function
# or constant that exists within
# a pre-defined module, import the
# module and then you can use its
# functions and constants.
# The book describes multiple means
# of importing modules. For simplicity
# we will use one method in lecture:
# import
# Suppose we want to use the math module
# (because it gives us the constant pi
# and functions like sin() and cos())
# To import the math module, include the
# line:
import math
# Be sure this import line is BEFORE
# any use of the functions or constants
# To use a function or constant from
# this imported library, use the form
# math.
# or
# math.
#
# for example:
math.pi
math.sin()
# Example use:
# Compute the area of a circle:
r = 3.2 # radius of the circle
A = math.pi * r * r
print('The area is %f' % (A))