# HG changeset patch # User Puneeth Chaganti # Date 1289452046 -19800 # Node ID 78d20cd87c7e20d0c957ac31aa7f2d63378ebb34 # Parent 0bb297415dfb9c72b6de4dff0847e45167cd82fa Added questions to writing python scripts. diff -r 0bb297415dfb -r 78d20cd87c7e writing_python_scripts/questions.rst --- a/writing_python_scripts/questions.rst Thu Nov 11 09:58:20 2010 +0530 +++ b/writing_python_scripts/questions.rst Thu Nov 11 10:37:26 2010 +0530 @@ -118,3 +118,29 @@ Hello World Hello Test + 7. Say, we wish to use the ``pi`` value from the ``math`` module in + the standard library. How do we import it? + + Answer: from math import pi OR import math.pi OR + import math.pi as pi + + + 8. A module should contain only functions, True or False? + + Answer: False. + + +Larger Questions +---------------- + +1. Look at the python documentation (from the web) and learn how to + make a folder containing some python files into a module. + + Answer: Add a file named __init__.py + +2. We know that ``sys.path`` has the paths in which Python checks for + a module, when it is imported. Suppose you have a package ``utils`` + in some location on your disk, which is not on the python path, how + will you import it? + + Answer: Append that path to the ``sys.path`` variable.