Posts tagged while-loops
Getting "Loopy" in Computer Science

Right now in Computer Science/ Coding we are learning about a very powerful tool – loops. Loops describe when we repeat an action for every item in a group or while a certain condition is true. Thus, we have two types of loops when programming with Python – for loops and while loops.

It can be helpful to think of loops in our everyday lives. Take icing cupcakes, for example. You bake 24 cupcakes and put icing on one cupcake at a time until you have iced all 24 cupcakes. Or you add pictures to Facebook and go through each one tagging your friends’ and family members’ faces until you get through all of the pictures. Both of these are examples of for loopsFor each item in the group (cupcakes, pictures, etc.), something happens to the item (the cupcake gets iced, the picture gets tagged, etc.)

While loops are a little different…

Read More
Coding a Card Game: Using Loops

A card game we played together recently inspired a new project we are working on during Computer Science/Coding. After breaking down the game and getting to the core of the rules and how the game flowed, we moved to writing pseudocode together. Then, a demonstration lead by Mrs. Lai involving articulating the steps of making a peanut butter and jelly sandwich helped us refine our understanding of the importance of not assuming anything while writing a program. We learned that writing our code out in a very clear and incremental fashion is necessary . . . when we didn’t have the steps of making a peanut butter and jelly sandwich articulated clearly enough, we almost put the peanut butter on the packaged loaf of bread! We refined our pseudocode with this new understanding and prepared to begin to code our game…

Read More