summaryrefslogtreecommitdiff
path: root/day1/Session-2.tex
diff options
context:
space:
mode:
authorPuneeth Chaganti2009-10-14 11:02:18 +0530
committerPuneeth Chaganti2009-10-14 11:02:18 +0530
commit8e41721ab17f6c780784ca4a03109b7e28cf3f01 (patch)
treee541d48679577a40e111532c0c4fe9aea5e30626 /day1/Session-2.tex
parentf877c076157c0cefcd7e93575c30c49d55be0ce9 (diff)
parenta0ff9c44bfd034c558454f9a8933e94b389cd1c4 (diff)
downloadworkshops-8e41721ab17f6c780784ca4a03109b7e28cf3f01.tar.gz
workshops-8e41721ab17f6c780784ca4a03109b7e28cf3f01.tar.bz2
workshops-8e41721ab17f6c780784ca4a03109b7e28cf3f01.zip
Merged with mainline.
Diffstat (limited to 'day1/Session-2.tex')
-rwxr-xr-xday1/Session-2.tex33
1 files changed, 12 insertions, 21 deletions
diff --git a/day1/Session-2.tex b/day1/Session-2.tex
index dd26535..21dfffd 100755
--- a/day1/Session-2.tex
+++ b/day1/Session-2.tex
@@ -159,32 +159,23 @@ The number of lines must be obtained from the user as input.\\
\section{Functions}
\subsection{Defining}
\begin{frame}[fragile]
-\frametitle{Functions: examples}
- \begin{lstlisting}
-def signum( r ):
- """returns 0 if r is zero
- -1 if r is negative
- +1 if r is positive"""
- if r < 0:
- return -1
- elif r > 0:
- return 1
- else:
- return 0
- \end{lstlisting}
+\frametitle{Functions: Definition}
+\begin{itemize}
+ \item \kwrd{def} keyword
+ \item
+\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Functions: examples}
\begin{lstlisting}
-def pad( n, size ):
- """pads integer n with spaces
- into a string of length size
- """
- SPACE = ' '
- s = str( n )
- padSize = size - len( s )
- return padSize * SPACE + s
+In [35]: def plot_sinx():
+ ....: x = linspace(0, 2*pi, 100)
+ ....: plt.plot(x, sin(x))
+ ....: plt.show()
+ ....:
+
+In [36]: plot_sinx()
\end{lstlisting}
\pause
\emphbar{What about \% formatting?}