Encourage students to get the for-loop counter right before adding code inside the for loop this will reduce the amount of time spent troubleshooting for-loops and ensure students are scaffolded well.
Show students to separate the for-loop header from the for-loop content when discussing how many times a for-loop loops because students can get overwhelmed, but need to be able to separate the conditional from the loop’s content.
Misconceptions: Students have difficulty with loops partially because the motivation for looping a small number of times seems insufficient.
Motivate for-loops by having students informally describe how to draw a set of 5 shapes, then having them turn this description into pseudocode to practice for-loops.
Having students trace a simple program for drawing a set of squares in Processing to introduce loops and strengthen student understanding for-loops with a body of code through practice.
Show a variety of for loops conditionals (e.g., < vs. <=; different variable names, different start values, different increment operations) to avoid common misconceptions about loops.
Distinguish the differences between print statements and return statements to help students understand that these elements are not related because this conflation can cause a lot of confusion.
Misconception: Return is a mystery to students because they may not understand that functions have an entry point and an exit point. This results in mistakes such as assuming Python will return the right thing.
Forward students links to programs in Python Tutor and ask them to answer questions about how the code works to go over what happens during a function call to provide students in-depth practice.
Explain that when you ask an object to do something the proper syntax in Java is to say object [dot] method, sometimes there is additional information required.