In lab demonstration of tracing code here.
For the advanced students in class, a demo of the power of ifs, fors, and whiles is available in the form of a tic-tac-toe program.
Write a while loop that prints the numbers between 1 ans 20
that are either divisible by 2 or by 3. Demo the code to me on your computer.
Note: you can use the remainder operator (%) to find out if a number is divisible by another number.
Note 2: don't print a number twice if it's divisible by both 2 and 3.
Example:
>>> ================================ RESTART ================================
>>>
0
2
3
4
6
8
9
10
12
14
15
16
18
>>>