Lesson 4

Snowflake Arms


Before we continue, remove lines 22 and 23 of our code. They should currently contain the “vshape()” and “input() code. These lines were needed for testing purposes, but won’t be used going forward.

define a second function for creating a single arm. We are defining functions to not have to type repeat lines of code throughout our project

Inside our snowflakeArm() function, students will be introduced to a for loop for the first time

A for loop is similar to a while loop but it uses an iterator or counter to set the number of times the block of code is executed versus a while loop can have an undetermined amount of times

An iterator is a variable that keeps track of the number of times a block of code is executed in a loop

An iterator is a variable that keeps track of the number of times a block of code is executed in a loop

x is the iterator, or counter, that keeps track of how many times the block of code has been executed

range(#) allows us to select a number we want to count to

IMPORTANT: it counts to one less than the parameter Ex: range(4) counts through 0, 1, 2, 3

Inside of the for loop, students need to make sure their tabs are lined up correctly. Emphasize just hitting enter after the colon