Unit 6 Lesson 8 Defining function with parameters


#1

I was completely overwhelmed with this lesson because I could not figure out how the program knew what to do with information about “player” until I realized that the function that was in the example solution has functions with parameters.

There needs to be a connection/practice opportunity for this. I do not believe that students have had any experience with this. Please direct me to it if they have.

Thank you,
Beth


#2

Just ran into the same problem. The parameter concept was new hadnt been introduced yet.


#3

Beth and Rothmana,

Completely agree that this is tricky. I introduce this as a code walk and progress through each line of code and stop to ask questions, mainly about why some variables are in quotes and some not - then making the connection between the player after “checkWin” and why that isn’t a string, and where else we see it in our code. Lesson 4 is great to see the 3 different types of planes and what happens if you use a string value to target one of the planes versus a parameter that passes in the value called.

Keep in mind that this is a more efficient way to code, but doesn’t mean your students have to do it this way. If your students can get it to run with all the additional code for each thing (plane, player, etc…) they can, and if a student or two got through this and is able to understand and use it, they can help explain to the class (and ask their permission to use their code as an example in later years).

Brad