Scratch Lab #9 Write Up

Name: Lexi Williams

Period: 7

Assignment: Lab #9

Lab Overview

This lab focused on lists. Lists are tools used to store multiple pices of information at a time and make it easier to see what is going on in a code.

My Solution

My solution for this problem includes creating a block that would go through the list of numbers given and decide whether the number was even or odd, and creating variables contine, odd, or even. The block can tell whether a number is even or odd by usinf the operator mod which when divded by 2 will result in a remainder or not. I then had to create the ccode that would set all the variables to 0 and delete the previous lists used. The main code included a repeat unitl loop that would ask for number and add those numbers to the list then ask if you would like to contine and if yes was typed you would continue to put in numbers and if no was typed then the loop would end and start a new loop. As the numbers were typed in, the even and odd variables would count the number of even or odd numbers and if tell us which ones were even and odd. If there were more even numbers than odd numbers the sprite's costume would change.

My Project Link

Questions

  1. What is the length of an “empty” list?
    • The length of and empty list is 0.
  2. Why are lists more powerful than variables?
    • Lists are more powerful than variables becasue lists are just variables that contain many other variables and get the work done faster.
  3. Can a list contain different data types? For example, could it store both numbers and words?
    • Yes a list can contain different data types. Yes lists can contain number and words at the same time.