Gallery
Solution Debug 6.3. Oddly Even
Share
Explore
Solution Debug 6.3. Oddly Even

icon picker
The Task

Activity: Debug 6.3 Odd or Even 🐞

Start Here

This program should count up to a limit input by the user. The program should display the numbers as it counts and display if the number is odd or even.
A bug report has been has been submitted on this program.
It uses a clever formula which we know is correct. However the program says all the numbers are odd, it seems to miss a number and it does not start at 1. We are suspicious of the loop and the IF…ELSE code.
We think there are more that one bug. You will have to experiment a bit to work out a fix. Don’t change too many things at once, always run the program to see what difference a change makes. Undo it if it gets worse!
Can you help fix it?
Run and explore the program to identify errors.
Read the comments and the Python code very carefully Think about what the code should be doing and what it is actually doing. You can also refer to the code clips below to help you fix the errors.
Right click on your code and add a comment explaining what was wrong and how you fixed it.
Good luck! 🍀

Sample Output

What number do you want to go up to? : 11


1 is odd
2 is even
3 is odd
4 is even
5 is odd
6 is even
7 is odd
8 is even
9 is odd
10 is even
11 is odd
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.