reviewed advanced features of functions script.
authorAnoop Jacob Thomas<anoop@fossee.in>
Thu, 28 Oct 2010 12:16:47 +0530
changeset 367 2ca9b21ed8f9
parent 366 894591150f7b
child 368 fd3c10a3d234
reviewed advanced features of functions script.
advanced-features-functions/script.rst
advanced-features-functions/slides.tex
manipulating-strings/slides.tex
progress.org
--- a/advanced-features-functions/script.rst	Wed Oct 27 19:25:45 2010 +0530
+++ b/advanced-features-functions/script.rst	Thu Oct 28 12:16:47 2010 +0530
@@ -17,7 +17,7 @@
 ..   #. getting started with functions
      
 .. Author              : Puneeth 
-   Internal Reviewer   : 
+   Internal Reviewer   : Anoop Jacob Thomas<anoop@fossee.in>
    External Reviewer   :
    Checklist OK?       : <put date stamp here, if OK> [2010-10-05]
 
@@ -57,7 +57,15 @@
 that the first one is equivalent to call with the second argument
 being 0. 0 is the default value of the argument. 
 
+.. #[[Anoop: It will be good if we show ``round??`` and tell them the
+   optional argument ndigits, or it could be given as an
+   exercise(solved) asking them to find the name of the argument in
+   the function round]]
+
 {{{ show a slide with examples of functions showing default values }}}
+
+.. #[[Anoop: I think the slide is not there]]
+
 ::
 
   s.strip() # strips on spaces. 
@@ -101,12 +109,17 @@
 
 Following is an (are) exercise(s) that you must do. 
 
+{{{ switch to next slide, containing problem statement of 
+    question 1 }}}
+
 %%1%% Redefine the function ``welcome``, by interchanging it's
 arguments. Place the ``name`` argument with it's default value of
 "World" before the ``greet`` argument.
 
 Please, pause the video here. Do the exercise and then continue. 
 
+{{{ switch to next slide, containing the solution to problem 1 }}}
+
 ::
 
   def welcome(name="World", greet):
@@ -116,25 +129,37 @@
 default argument``. When defining a function all the argument with
 default values should come at the end. 
 
+.. #[[Anoop: In the slide, "when defining a function all the default
+   arguments must be defined at the end" has to be emphasized"]]
+
 Following is an exercise that you must do. 
 
+{{{ switch to next slide, containing the problem statement of 
+    question 2 }}}
+
 %%2%% See the definition of linspace using ``?`` and observe how all
 the arguments with default values are towards the end.
 
 Please, pause the video here. Do the exercise and then continue. 
 
+{{{ switch to next slide, containing solution to problem 2 }}}
+
 ::
 
   linspace?
 
 Following is an exercise that you must do. 
 
+{{{ switch to next slide, problem statement }}}
+
 %%3%% Redefine the function ``welcome`` with a default value of
 "Hello" to the ``greet`` argument. Then, call the function without any
 arguments. 
 
 Please, pause the video here. Do the exercise and then continue. 
 
+{{{ switch to next slide, solution }}}
+
 ::
 
   def welcome(greet="Hello", name="World"):
@@ -147,6 +172,9 @@
 Let us now learn what keyword arguments are. 
 
 {{{ show a slide with examples using keyword arguments. }}}
+
+.. #[[Anoop: slide is missing]]
+
 ::
 
   legend(['sin(2y)'], loc = 'center')
@@ -157,6 +185,14 @@
 
   pie(science.values(), labels = science.keys())
 
+.. #[[Anoop: I think it will better to introduce keyword arguments as
+   keyword/named arguments, as the keyword term was quite confusing
+   for me, so can be for someone who already know certain
+   jargon's/concepts, also it would be good to tell them that these
+   are different from keywords in programming languages, explicit is
+   better than implicit, and probably you could also tell them that
+   from now on we will refer to it as just keyword arguments]]
+
 When you are calling functions in Python, you don't need to remember
 the order in which to pass the arguments. Instead, you can use the
 name of the argument to pass it a value. This slide shows a few
@@ -199,6 +235,8 @@
 
 {{{ switch to a slide showing variety of functions with uses }}}
 
+.. #[[Anoop: slide missing]]
+
 Before defining a function of your own, make sure that you check the
 standard library, for a similar function. Python is popularly called a
 "Batteries included" language, for the huge library that comes along
@@ -214,6 +252,8 @@
 
 {{{ switch to slide showing classes of functions in pylab, scipy }}}
 
+.. #[[Anoop: slide missing]]
+
 Apart from the standard library there are other libraries like ``pylab``,
 ``scipy``, etc which have a huge collection of functions for scientific
 purposes. 
@@ -227,6 +267,9 @@
 
 {{{ Show summary slide }}}
 
+.. #[[Anoop: add range of functions available in python standard
+   library]]
+
 That brings us to the end of this tutorial. In this tutorial we have
 learnt how to use functions with default values and keyword
 arguments. We also looked at the range of functions available in the
--- a/advanced-features-functions/slides.tex	Wed Oct 27 19:25:45 2010 +0530
+++ b/advanced-features-functions/slides.tex	Thu Oct 28 12:16:47 2010 +0530
@@ -1,4 +1,4 @@
-% Created 2010-10-11 Mon 00:34
+% Created 2010-10-28 Thu 11:37
 \documentclass[presentation]{beamer}
 \usepackage[latin1]{inputenc}
 \usepackage[T1]{fontenc}
@@ -8,6 +8,7 @@
 \usepackage{float}
 \usepackage{wrapfig}
 \usepackage{soul}
+\usepackage{t1enc}
 \usepackage{textcomp}
 \usepackage{marvosym}
 \usepackage{wasysym}
@@ -62,11 +63,10 @@
 \frametitle{Solution 1}
 \label{sec-3}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 def welcome(name="World", greet):
     print greet, name
-\end{lstlisting}
+\end{verbatim}
   We get an error that reads \texttt{SyntaxError: non-default argument   follows default argument}. When defining a function all the
   argument with default values should come at the end.
 \end{frame}
@@ -81,10 +81,9 @@
 \frametitle{Solution 2}
 \label{sec-5}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 linspace?
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Question 3}
@@ -98,13 +97,12 @@
 \frametitle{Solution 3}
 \label{sec-7}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 def welcome(greet="Hello", name="World"):
     print greet, name
 
 welcome()
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Summary}
--- a/manipulating-strings/slides.tex	Wed Oct 27 19:25:45 2010 +0530
+++ b/manipulating-strings/slides.tex	Thu Oct 28 12:16:47 2010 +0530
@@ -1,4 +1,4 @@
-% Created 2010-10-11 Mon 11:27
+% Created 2010-10-28 Thu 11:35
 \documentclass[presentation]{beamer}
 \usepackage[latin1]{inputenc}
 \usepackage[T1]{fontenc}
@@ -8,6 +8,7 @@
 \usepackage{float}
 \usepackage{wrapfig}
 \usepackage{soul}
+\usepackage{t1enc}
 \usepackage{textcomp}
 \usepackage{marvosym}
 \usepackage{wasysym}
@@ -63,10 +64,9 @@
 \frametitle{Solution 1}
 \label{sec-3}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 In []:  s[1:-1]
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Question 2}
@@ -80,11 +80,10 @@
 \frametitle{Solution 2}
 \label{sec-5}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 In []:  s in week
 In []:  s.lower()[:3] in week
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Question 3}
@@ -98,11 +97,10 @@
 \frametitle{Solution 3}
 \label{sec-7}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 email.replace('[dot], '.')
 print email
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Question 4}
@@ -115,10 +113,9 @@
 \frametitle{Solution 4}
 \label{sec-9}
 
-\lstset{language=Python}
-\begin{lstlisting}
+\begin{verbatim}
 email_str = email_str.replace(",", ";")
-\end{lstlisting}
+\end{verbatim}
 \end{frame}
 \begin{frame}
 \frametitle{Summary}
--- a/progress.org	Wed Oct 27 19:25:45 2010 +0530
+++ b/progress.org	Thu Oct 28 12:16:47 2010 +0530
@@ -40,14 +40,14 @@
 | 6.5 LO: | Assessment                             |     3 | Anoop    |                                       |           |
 |---------+----------------------------------------+-------+----------+---------------------------------------+-----------|
 | 7.1 LO: | manipulating lists                     |     3 | Madhu    |                                       |           |
-| 7.2 LO: | manipulating strings                   |     2 | Punch    | Anoop(Pending)                        |           |
+| 7.2 LO: | manipulating strings                   |     2 | Punch    | Amit(Done)                            |           |
 | 7.3 LO: | getting started with tuples            |     2 | Nishanth |                                       |           |
 | 7.4 LO: | dictionaries                           |     2 | Anoop    | Punch (Done)                          |           |
 | 7.5 LO: | sets                                   |     2 | Nishanth |                                       |           |
 | 7.6 LO: | Assessment                             |     3 | Amit     |                                       |           |
 |---------+----------------------------------------+-------+----------+---------------------------------------+-----------|
 | 8.1 LO: | getting started with functions         |     3 | Nishanth |                                       |           |
-| 8.2 LO: | advanced features of functions         |     3 | Punch    | Anoop(Pending)                        |           |
+| 8.2 LO: | advanced features of functions         |     3 | Punch    | Anoop(Done)                           |           |
 | 8.3 LO: | using python modules                   |     3 | Anoop    | Punch (Done)                          |           |
 | 8.4 LO: | writing python scripts                 |     2 | Nishanth |                                       |           |
 | 8.5 LO: | testing and debugging                  |     2 | Amit     |                                       |           |