changeset 48 | 7f4c51382f89 |
parent 46 | 63704b5650f1 |
47:21de307e6823 | 48:7f4c51382f89 |
---|---|
1 \frametitle {Basic looping} |
|
2 \begin{lstlisting} |
|
3 # Fibonacci series: |
|
4 # the sum of two elements |
|
5 # defines the next |
|
6 a, b = 0, 1 |
|
7 while b < 10: |
|
8 print b, |
|
9 a, b = b, a + b |
|
10 |
|
11 \end{lstlisting} |
|
12 \typ{1 1 2 3 5 8}\\ |
|
13 \alert{Recall it is easy to write infinite loops with \kwrd{while}} |
|
14 \inctime{20} |