day1/Session-1.vrb
author Santosh G. Vattam <vattam.santosh@gmail.com>
Thu, 08 Oct 2009 22:48:06 +0530
changeset 74 a476c09dcf24
parent 46 63704b5650f1
permissions -rw-r--r--
Session 1 slides completed. Session 3 third iteration.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
\frametitle {Basic looping}
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
  \begin{lstlisting}
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Fibonacci series:
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
# the sum of two elements
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
# defines the next
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
a, b = 0, 1
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
while b < 10:
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
    print b,
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
    a, b = b, a + b
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
\end{lstlisting}
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
\typ{1 1 2 3 5 8}\\
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
\alert{Recall it is easy to write infinite loops with \kwrd{while}}
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
  \inctime{20}