summaryrefslogtreecommitdiff
path: root/day1/Session-2.tex
diff options
context:
space:
mode:
authorSantosh G. Vattam2009-10-13 16:40:05 +0530
committerSantosh G. Vattam2009-10-13 16:40:05 +0530
commita0ff9c44bfd034c558454f9a8933e94b389cd1c4 (patch)
tree9b58c83ec09c81cc73314f668d521b9cd0d21205 /day1/Session-2.tex
parent2e00ef3f3a03d8c9692bc1de035f2010c5be1cca (diff)
downloadworkshops-a0ff9c44bfd034c558454f9a8933e94b389cd1c4.tar.gz
workshops-a0ff9c44bfd034c558454f9a8933e94b389cd1c4.tar.bz2
workshops-a0ff9c44bfd034c558454f9a8933e94b389cd1c4.zip
Added session2.tex.
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?}