Scratch Lab 9 Write Up

Name: Olivia Moore

Period: 7

Assignment: Scratch Lab #9

The full lab description is found HERE.

Lab Overview

We were to code a somewhat calculator and determine whether a number was even or odd. This involved using modular arithmetic to use the remainder as a guideline for if the number given by the user is even or odd. Then, we had to store the numbers given in a list and keep track of how many even and odd numbers there are. If there were more even numbers than odd numbers, we had to make the sprite change its costume. Using a big block made everything a lot easier, too. This lab was easier than I expected it to be and I liked it.

My Solution

My solution for the "calculator" was to make a block called "even or odd" and ask the user for a number. This number was then added to a list called "numbers" and determined if it was even or odd. Using modular arithmetic, setting the mod of answer by 2 = 0 means the number is even, so anything else would be odd. If even > odd, then the sprite would switch to the next costume. Blocks and modular arithmetic make codes be more customized and better organized and easier to use to get a sprite or program to do what you want.

My Project Link

Questions

  1. An empty list has zero length.
  2. A list can hold theoretically an infinite amount of information, whereas a variable can hold only 1 piece of information. A list holds variables basically.
  3. Yes, a list can hold both words and numbers.