Scratch Lab #9

Name: Robby Rowell

Period: 7

Assignment: Scratch Lab #9

Lab Overview

This lab required us to use lists and operators to create a sprite that can tell if a number is even or odd and counts the number of even and odd numbers in the list.

My Solution

My solution was to create a block that calculated whether a number was even or odd by using the mod block and finding numbers that had remainders of zero when divided by 2. I had the sprite ask the user what number they wanted to use. The next step was to create a list, and I had each answer added to the list. I also created two variables that would increase by one depending on whether an even or odd number was enetered. The final step was to ask whether the user wants to continue. I made a new variable that has its value set to the answer. If the answer is no, the lists and variables are cleared and the program ends. If the answer is yes, the program continues.

My Project Link

Questions

  1. What is the length of an “empty” list?
      The length of an empty list is zero.
  2. Why are lists more powerful than variables?
      You can store as many values as necessary for as long as necessary, while with variables the previous value is deleted every time a new one is inputed.
  3. Can a list contain different data types? For example, could it store both numbers and words?
      Yes, lists can store both numbers and words.