getting-started-with-functions/slides.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Wed, 10 Nov 2010 18:58:11 +0530
changeset 445 0c8ab2b5225b
child 446 2ce824b5adf4
permissions -rw-r--r--
added slides for getting started with functions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
445
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     1
% Created 2010-11-10 Wed 18:55
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     2
\documentclass[presentation]{beamer}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     3
\usepackage[latin1]{inputenc}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     4
\usepackage[T1]{fontenc}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     5
\usepackage{fixltx2e}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     6
\usepackage{graphicx}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     7
\usepackage{longtable}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     8
\usepackage{float}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     9
\usepackage{wrapfig}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    10
\usepackage{soul}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    11
\usepackage{t1enc}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    12
\usepackage{textcomp}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    13
\usepackage{marvosym}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    14
\usepackage{wasysym}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    15
\usepackage{latexsym}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    16
\usepackage{amssymb}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    17
\usepackage{hyperref}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    18
\tolerance=1000
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    19
\usepackage[english]{babel} \usepackage{ae,aecompl}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    20
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    21
\usepackage{listings}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    22
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    23
commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    24
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    25
\providecommand{\alert}[1]{\textbf{#1}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    26
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    27
\title{Getting started with functions}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    28
\author{FOSSEE}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    29
\date{}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    30
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    31
\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    32
\begin{document}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    33
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    34
\maketitle
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    35
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    36
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    37
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    38
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    39
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    40
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    41
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    42
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    43
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    44
    
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    45
    
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    46
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    47
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    48
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    49
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    50
\frametitle{Outline}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    51
\label{sec-1}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    52
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    53
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    54
\item Define functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    55
\item Pass arguments to functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    56
\item Learn about docstrings
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    57
\item Return values from functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    58
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    59
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    60
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    61
\frametitle{Function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    62
\label{sec-2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    63
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    64
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    65
\item Eliminate code redundancy
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    66
\item Help in code reuse
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    67
\item Subroutine
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    68
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    69
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    70
\item relatively independent of remaining code
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    71
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    72
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    73
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    74
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    75
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    76
\frametitle{\texttt{f(x)} a mathematical function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    77
\label{sec-3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    78
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    79
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    80
  $f(x) = x^{2}$
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    81
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    82
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    83
   f(1) -> 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    84
   f(2) -> 4
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    85
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    86
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    87
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    88
\frametitle{Define \texttt{f(x)} in Python}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    89
\label{sec-4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    90
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    91
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    92
def f(x):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    93
    return x*x
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    94
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    95
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    96
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    97
\item \texttt{def} - keyword
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    98
\item \texttt{f} - function name
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    99
\item \texttt{x} - parameter / argument to function \texttt{f}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   100
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   101
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   102
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   103
\frametitle{Exercise 1}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   104
\label{sec-5}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   105
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   106
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   107
  Write a python function named \texttt{cube} which computes the cube of a given
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   108
  number \texttt{n}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   109
  
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   110
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   111
\item Pause here and try to solve the problem yourself.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   112
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   113
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   114
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   115
\frametitle{Solution}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   116
\label{sec-6}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   117
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   118
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   119
def cube(n):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   120
    return n**3
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   121
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   122
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   123
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   124
\frametitle{\texttt{greet} function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   125
\label{sec-7}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   126
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   127
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   128
 Function \texttt{greet} which will print \texttt{Hello World!}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   129
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   130
def greet():
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   131
    print "Hello World!"
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   132
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   133
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   134
\item Call the function \texttt{greet}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   135
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   136
     In []: greet()
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   137
     Hello World!
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   138
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   139
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   140
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   141
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   142
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   143
\frametitle{Exercise 2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   144
\label{sec-8}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   145
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   146
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   147
  Write a python function named \texttt{avg} which computes the average of
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   148
  \texttt{a} and \texttt{b}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   149
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   150
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   151
\item Pause here and try to solve the problem yourself.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   152
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   153
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   154
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   155
\frametitle{Solution 2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   156
\label{sec-9}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   157
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   158
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   159
def avg(a,b):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   160
    return (a + b)/2
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   161
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   162
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   163
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   164
\item \texttt{a} and \texttt{b} are parameters
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   165
\item \texttt{def f(p1, p2, p3, ... , pn)}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   166
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   167
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   168
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   169
\frametitle{Docstring}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   170
\label{sec-10}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   171
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   172
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   173
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   174
\item Documenting/commenting code is a good practice
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   175
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   176
def avg(a,b):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   177
    """ avg takes two numbers as input 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   178
    (a & b), and returns the average 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   179
    of a and b"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   180
    return (a+b)/2
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   181
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   182
\item Docstring
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   183
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   184
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   185
\item written in the line after the \texttt{def} line.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   186
\item Inside triple quote.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   187
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   188
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   189
\item Documentation
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   190
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   191
     avg?
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   192
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   193
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   194
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   195
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   196
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   197
\frametitle{Exercise 3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   198
\label{sec-11}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   199
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   200
  Add docstring to the function f.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   201
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   202
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   203
\frametitle{Solution 3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   204
\label{sec-12}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   205
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   206
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   207
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   208
def f(x):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   209
    """Accepts a number x as argument and,
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   210
    returns the square of the number x."""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   211
    return x*x
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   212
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   213
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   214
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   215
\frametitle{Exercise 4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   216
\label{sec-13}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   217
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   218
  Write a python function named \texttt{circle} which returns the area and
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   219
  perimeter of a circle given radius \texttt{r}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   220
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   221
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   222
\frametitle{Solution 4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   223
\label{sec-14}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   224
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   225
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   226
def circle(r):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   227
    """returns area and perimeter of a circle given 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   228
    radius r"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   229
    pi = 3.14
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   230
    area = pi * r * r
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   231
    perimeter = 2 * pi * r
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   232
    return area, perimeter
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   233
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   234
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   235
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   236
\frametitle{\texttt{what}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   237
\label{sec-15}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   238
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   239
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   240
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   241
def what( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   242
    if n < 0: n = -n
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   243
    while n > 0:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   244
        if n % 2 == 1:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   245
            return False
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   246
        n /= 10
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   247
    return True
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   248
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   249
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   250
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   251
\frametitle{\texttt{even\_digits}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   252
\label{sec-16}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   253
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   254
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   255
def even_digits( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   256
   """returns True if all the digits of number 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   257
   n is even returns False if all the digits 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   258
   of number n is not even"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   259
    if n < 0: n = -n
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   260
    while n > 0:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   261
        if n % 2 == 1:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   262
            return False
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   263
        n /= 10
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   264
    return True
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   265
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   266
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   267
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   268
\frametitle{\texttt{what}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   269
\label{sec-17}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   270
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   271
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   272
def what( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   273
    i = 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   274
    while i * i < n:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   275
        i += 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   276
    return i * i == n, i
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   277
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   278
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   279
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   280
\frametitle{\texttt{is\_perfect\_square}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   281
\label{sec-18}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   282
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   283
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   284
def is_perfect_square( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   285
    """returns True and square root of n, 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   286
    if n is a perfect square, otherwise 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   287
    returns False and the square root 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   288
    of the next perfect square"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   289
    i = 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   290
    while i * i < n:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   291
        i += 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   292
    return i * i == n, i
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   293
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   294
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   295
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   296
\frametitle{Summary}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   297
\label{sec-19}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   298
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   299
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   300
\item Functions in Python
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   301
\item Passing parameters to a function
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   302
\item Returning values from a function
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   303
\item We also did few code reading exercises.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   304
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   305
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   306
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   307
\frametitle{Thank you!}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   308
\label{sec-20}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   309
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   310
  \begin{block}{}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   311
  \begin{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   312
  This spoken tutorial has been produced by the
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   313
  \textcolor{blue}{FOSSEE} team, which is funded by the 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   314
  \end{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   315
  \begin{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   316
    \textcolor{blue}{National Mission on Education through \\
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   317
      Information \& Communication Technology \\ 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   318
      MHRD, Govt. of India}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   319
  \end{center}  
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   320
  \end{block}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   321
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   322
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   323
\end{document}