Scratch Lab 9

Even or Odd

Lab Overview

The lab asked me to program a list and have the sprite enter even or odd numbers. The sprite is to change colors if the number of evens are more than the number of odds the costume changes.

My Solution

I created a list and a separate block called even and odd. I had the block use if then statements to assertain whether a number is even or odd. This number was added to the list and I had two separate variables counting the even or odd numbers. Once the loop ends when the user tells it to, if the number of evens are greater than the number of odds the sprite will change costumes.

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?

They can hold multiple inputs at the same time

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

Yes it can.