summaryrefslogtreecommitdiff
path: root/advanced_python
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-11-12 00:15:55 +0530
committerPrabhu Ramachandran2017-11-12 00:15:55 +0530
commitc2e5205991e5007b2f54f5169c342818760812b2 (patch)
treee17e6a328a1e0ba99c0d58b47bdf564a70e88f65 /advanced_python
parentd7e4d9c4f65c439bab83de9a0e1c1f0ab8206834 (diff)
downloadpython-workshops-c2e5205991e5007b2f54f5169c342818760812b2.tar.gz
python-workshops-c2e5205991e5007b2f54f5169c342818760812b2.tar.bz2
python-workshops-c2e5205991e5007b2f54f5169c342818760812b2.zip
Add one more complex exercise.
Diffstat (limited to 'advanced_python')
-rw-r--r--advanced_python/names_objects.tex19
1 files changed, 19 insertions, 0 deletions
diff --git a/advanced_python/names_objects.tex b/advanced_python/names_objects.tex
index f7ef9a6..889741d 100644
--- a/advanced_python/names_objects.tex
+++ b/advanced_python/names_objects.tex
@@ -333,5 +333,24 @@ f(2)
\end{frame}
+\begin{frame}[fragile]
+ \frametitle{Exercise 5}
+\begin{lstlisting}
+def mul(x):
+ def g(y):
+ return y*x
+ return g
+
+twice = mul(2.0)
+twice(20)
+\end{lstlisting}
+\vspace*{0.1in}
+ \begin{itemize}
+ \item Run step-by-step on \url{pythontutor.com}
+ \item Predict the output before you see the answer
+ \end{itemize}
+
+\end{frame}
+
\end{document}