Lab Overview

Problem 1

For Problem 1, we learned to use lists by having scratch tell you if the numbers you entered were even or odd.

My Solution

Problem 1 Solution

For problem one, I first defined a new block called "Even or Odd" which would mod each item on the list by 2. If the answer was one, then it would say the number is odd and add one to a variable called "# of Odd". Otherwise, it would say it is even and add one to the # of even. To make the list, I had a sprite repeat asking for a number until you respond no, which will then tell you if each number is even or odd. Finally, I had it check if the # of even outnumbered the # of odd, and if so, it changes the costume of the sprite.


What is the length of an empty list?

An empty list has a length of zero.

Why are lists more powerful than variables?

Lists can hold more than one data value at a time.

Can a list contain different data types? For example, could it store both numbers and words?