design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
5.6b
LO: To debug simple programs.
Hopefully you have been collecting code to debug everytime you help out someone who has made an error - this code will better reflect the mistakes that the children really are making. Let's look at some different types of bugs in code:
typing bugs - incorrect spellings, no spaces, spaces where there shouldn't be any, capital letters (except True and False).
copy-and-paste bugs - can lead to incorrect indentation (what belongs to what), missing parts (the pasted code may call a function that is not pasted along with it).
code working but doing the 'wrong' thing bugs - hard to find, use the step control in Reeborg, you can use comments (#) to temporarily cut out code to make it simpler to see where things start to go wrong, you can use the print() function to print out values at any part of your code to keep track of things.
making assumptions bugs - thinking that things will work in a certain way, testing your assumptions in the IDLE shell will be quicker than debugging your code.