LESSON 4–FINISH

  1. Dancing with Functions
  2. Finish & Show me 1.4.4 & 1.4.5

LESSON 5

GOAL: You will gain a deeper understanding of functions. You will be able to explain the importance of writing readable code, and you will be able to analyze and compare the readability of different programs. You will be able to use the start function to make your programs more readable.

VOCAB:

Term Definition
Read Like a Story Programs that “Read like a story” have good decomposition and make the code easy to follow.
Define a Function Defining a function means to teach the computer a new command and explain what it should do when receiving that command.
Call a Function Calling a function actually gives the command, so the computer will run the code for that function.
Start Function This is the function that is called when you click run.

DO THE FOLLOWING IN ORDER:

  1. REVIEW:
    1. Get the Naming Functions handout from your teacher & complete it–show me before continuing
    2. Get the What’s Wrong with the Functions? handout from your teacher & complete it–show me before continuing
    3. Do:  1.4.2 Functions in Karel Quiz
  2. Watch:  1.5.1 The Start Function
  3. What did you notice about the format and syntax of calling functions?
  4. Do & experiment:  1.5.3 Tower with Start Function
  5. Do & show me:  1.5.4 Pancakes with Start
  6. You are going to create your own Karel program using the Sandbox feature. Its important that before you edit Karel worlds that you have an objective for what you would like Karel to do. Write out what the objective is first, then develop a solution for it in your Word Online file for this class.
  7. Create a new Karel program using the Sandbox feature:
    1. Click on the Sandbox tab.
    2. Let’s create a new Karel program together by naming it MyFirstKarelProgram and choosing KAREL for the type of program.
    3. Click on Edit Karel Worlds and try to:
      • Move Karel’s start row and column
      • Changing the width and height
      • Changing Karel’s start direction
      • Adding and Removing a Ball
      • Adding and Removing a Wall
      • Moving Karel
  8. Extra Credit Opportunities:
    1. Create a poster that lists the rules or Do/Don’ts for defining and calling functions.
    2. My Day in Functions–Think about your typical school day. What are the functions that you routinely perform that can be defined like a function? Write out what your day looks like by writing at least 3 functions and calling them throughout your day.Examplefunction start(){snapChat();takeNotes();}function snapChat(){

      openApp();

      takePhoto();

      send();

      }

      function takeNotes(){

      takeOutPaper();

      writeVocabWords();

      }

Leave a comment

Your email address will not be published. Required fields are marked *