getting-started-with-functions/slides.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Wed, 10 Nov 2010 19:00:23 +0530
changeset 446 2ce824b5adf4
parent 445 0c8ab2b5225b
permissions -rw-r--r--
removed unwanted data from slides.org file for getting started with functions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
446
2ce824b5adf4 removed unwanted data from slides.org file for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents: 445
diff changeset
     1
% Created 2010-11-10 Wed 18:59
445
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
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    45
\frametitle{Outline}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    46
\label{sec-1}
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
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    49
\item Define functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    50
\item Pass arguments to functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    51
\item Learn about docstrings
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    52
\item Return values from functions
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    53
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    54
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    55
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    56
\frametitle{Function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    57
\label{sec-2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    58
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    59
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    60
\item Eliminate code redundancy
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    61
\item Help in code reuse
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    62
\item Subroutine
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 relatively independent of remaining code
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    66
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    67
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    68
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    69
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    70
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    71
\frametitle{\texttt{f(x)} a mathematical function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    72
\label{sec-3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    73
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    74
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    75
  $f(x) = x^{2}$
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    76
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    77
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    78
   f(1) -> 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    79
   f(2) -> 4
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    80
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    81
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    82
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    83
\frametitle{Define \texttt{f(x)} in Python}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    84
\label{sec-4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    85
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    86
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    87
def f(x):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    88
    return x*x
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    89
\end{verbatim}
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{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    92
\item \texttt{def} - keyword
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    93
\item \texttt{f} - function name
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    94
\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
    95
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    96
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    97
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    98
\frametitle{Exercise 1}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    99
\label{sec-5}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   100
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   101
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   102
  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
   103
  number \texttt{n}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   104
  
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   105
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   106
\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
   107
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   108
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   109
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   110
\frametitle{Solution}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   111
\label{sec-6}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   112
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   113
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   114
def cube(n):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   115
    return n**3
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   116
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   117
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   118
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   119
\frametitle{\texttt{greet} function}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   120
\label{sec-7}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   121
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   122
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   123
 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
   124
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   125
def greet():
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   126
    print "Hello World!"
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   127
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   128
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   129
\item Call the function \texttt{greet}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   130
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   131
     In []: greet()
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   132
     Hello World!
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   133
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   134
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   135
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   136
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   137
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   138
\frametitle{Exercise 2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   139
\label{sec-8}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   140
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   141
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   142
  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
   143
  \texttt{a} and \texttt{b}.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   144
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   145
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   146
\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
   147
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   148
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   149
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   150
\frametitle{Solution 2}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   151
\label{sec-9}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   152
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   153
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   154
def avg(a,b):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   155
    return (a + b)/2
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   156
\end{verbatim}
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{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   159
\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
   160
\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
   161
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   162
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   163
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   164
\frametitle{Docstring}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   165
\label{sec-10}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   166
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   167
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   168
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   169
\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
   170
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   171
def avg(a,b):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   172
    """ avg takes two numbers as input 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   173
    (a & b), and returns the average 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   174
    of a and b"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   175
    return (a+b)/2
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   176
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   177
\item Docstring
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   178
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   179
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   180
\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
   181
\item Inside triple quote.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   182
\end{itemize}
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
\item Documentation
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   185
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   186
     avg?
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   187
\end{verbatim}
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
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   190
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   191
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   192
\frametitle{Exercise 3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   193
\label{sec-11}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   194
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   195
  Add docstring to the function f.
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   196
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   197
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   198
\frametitle{Solution 3}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   199
\label{sec-12}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   200
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   201
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   202
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   203
def f(x):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   204
    """Accepts a number x as argument and,
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   205
    returns the square of the number x."""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   206
    return x*x
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   207
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   208
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   209
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   210
\frametitle{Exercise 4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   211
\label{sec-13}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   212
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   213
  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
   214
  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
   215
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   216
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   217
\frametitle{Solution 4}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   218
\label{sec-14}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   219
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   220
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   221
def circle(r):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   222
    """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
   223
    radius r"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   224
    pi = 3.14
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   225
    area = pi * r * r
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   226
    perimeter = 2 * pi * r
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   227
    return area, perimeter
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   228
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   229
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   230
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   231
\frametitle{\texttt{what}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   232
\label{sec-15}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   233
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   234
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   235
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   236
def what( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   237
    if n < 0: n = -n
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   238
    while n > 0:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   239
        if n % 2 == 1:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   240
            return False
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   241
        n /= 10
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   242
    return True
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   243
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   244
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   245
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   246
\frametitle{\texttt{even\_digits}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   247
\label{sec-16}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   248
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   249
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   250
def even_digits( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   251
   """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
   252
   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
   253
   of number n is not even"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   254
    if n < 0: n = -n
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   255
    while n > 0:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   256
        if n % 2 == 1:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   257
            return False
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   258
        n /= 10
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   259
    return True
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   260
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   261
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   262
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   263
\frametitle{\texttt{what}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   264
\label{sec-17}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   265
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   266
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   267
def what( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   268
    i = 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   269
    while i * i < n:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   270
        i += 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   271
    return i * i == n, i
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   272
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   273
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   274
\begin{frame}[fragile]
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   275
\frametitle{\texttt{is\_perfect\_square}}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   276
\label{sec-18}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   277
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   278
\begin{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   279
def is_perfect_square( n ):
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   280
    """returns True and square root of n, 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   281
    if n is a perfect square, otherwise 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   282
    returns False and the square root 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   283
    of the next perfect square"""
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   284
    i = 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   285
    while i * i < n:
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   286
        i += 1
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   287
    return i * i == n, i
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   288
\end{verbatim}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   289
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   290
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   291
\frametitle{Summary}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   292
\label{sec-19}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   293
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   294
\begin{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   295
\item Functions in Python
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   296
\item Passing parameters to a function
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   297
\item Returning values from a function
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   298
\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
   299
\end{itemize}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   300
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   301
\begin{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   302
\frametitle{Thank you!}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   303
\label{sec-20}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   304
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   305
  \begin{block}{}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   306
  \begin{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   307
  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
   308
  \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
   309
  \end{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   310
  \begin{center}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   311
    \textcolor{blue}{National Mission on Education through \\
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   312
      Information \& Communication Technology \\ 
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   313
      MHRD, Govt. of India}.
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
  \end{block}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   316
\end{frame}
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   317
0c8ab2b5225b added slides for getting started with functions.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
   318
\end{document}