ODDS & EVENS
1. Study the Python code below.
Predict what the output would be.
2. Go to cscircles.cemc.uwaterloo.ca/console. Enter and run the Python code from #1. Plot the number and sum values on the grid below. What is the equation of the function plotted?
3. Edit the Python code from #1 to list the first 5 even numbers and sums. Sample output shown below.
4. Edit the Python code from #3 to list the first 5 natural numbers and sums. Sample output shown below.
5. The 3 images below relate to the ideas above. The first image is annotated as an example. Similarly annotate the other 2 images.
- The first 5 odd numbers fit in a 5 x 5 square, and their sum is 25.
- The first N odd numbers fit in a NxN square, and their sum is N2.