Scratch Lab #9

Name: Matthew Moorehead

Date: December 2nd, 2015

Period: 7

Assignment: Lab #9

Lab Overview

This problem asked us to ask the user to choose a number and the computer would tell if the number is even or odd. Then, we had to add the value to the list called "numbers" and ask if the user wants to choose another number. If the user wants to play again, they choose another number and that number is added to the list. If they say no, it deletes all of the numbers on the list.

My Solution

To solve this, I first made a block which asks the user to choose a number. Then I made a list and made the answer add to the list. To decide if it is either or odd, I made an if then statement and a mod operator to know if it is an even number. It then says if it is even or odd. Then, I made three variables, end, odd, and even. Then, I made a repeat until end is no and placed the block into it an asked if the user wants more numbers to place. If not, it will delete all of the numbers on the list.

My Project Link

Questions

  1. What is the length of an “empty” list?
    • The length of an “empty” list is zero because there are no values or words placed in the list column.
  2. Why are lists more powerful than variables?
    • Lists are more powerful than variables because there can be an infinite amount of words or numbers stored which won't be deleted unless told to. Variables, however, only keep one number or word and deletes the prior numbers or words. Also, lists are shown on the screen which shows the user all of the values or words, whereas variables only show one value or word. This makes it so there only needs one list while a new variable needs to be made for each new value or word.
  3. Can a list contain different data types? For example, could it store both numbers and words?
    • Yes, they can contain different data types. By asking a question, you can receive an answer that can either be in letters or in numbers. This then goes over to the list where the data is and shows either letters or numbers in the data spots.