diff -r 4075482a9770 -r 0a6ab1d81491 day2/cheatsheet4.tex --- a/day2/cheatsheet4.tex Tue Dec 08 12:40:07 2009 +0530 +++ b/day2/cheatsheet4.tex Tue Dec 08 13:06:14 2009 +0530 @@ -22,11 +22,11 @@ \date{} \vspace{-1in} \begin{center} -\LARGE{Python: Python Development}\\ +\LARGE{Python Development}\\ \large{FOSSEE} \end{center} \section{Module} -Packages like \typ{scipy}, \typ{pylab} etc we used for functions like \typ{plot} are Modules. Modules are Python script, which have various functions and objects, which if imported can be reused. +Packages like \typ{scipy}, \typ{pylab} etc we used for functions like \typ{plot}, \typ{linspace} are \textbf{Modules}. They are Python script, which have various functions and objects, which can be imported and reused. \begin{lstlisting} def gcd(a, b): if a % b == 0: @@ -39,6 +39,7 @@ Save above mentioned python script with name 'gcd.py'. Now we can \typ{import} \typ{gcd} function. For example, in same directory create 'lcm.py' with following content: \begin{lstlisting} from gcd import gcd + def lcm(a, b): return (a * b) / gcd(a, b) @@ -63,7 +64,7 @@ print gcd(15, 65) print gcd(16, 76) \end{lstlisting} -This \typ{__main__()} helps to create standalone scripts. Code inside it is only executed when we run gcd.py. Hence +\typ{__main__()} helps to create standalone scripts. Code inside it is only executed when we run gcd.py. Hence \begin{lstlisting} $ python gcd.py 5