Accessing a List: Shopping
You can access your list's properties like the items themselves and the length.
Suppose you have an animation where Codey is going shopping with a shopping list. You already created a list for him.
He has to check:
the size of the list
the items in the list
and if certain items are in the list
What is in my list?
To determine what items are in the shopping list, use the item block to tell you the item. The first parameter is the position of the item in the list.
You can use:
An integer
last - This give you the last item in the list
any - This gives you a random item in the list.
What is the size of my list?
To determine the number of items in the shopping list, use the length block.
How do I know if something is in my list?
To determine whether or not something is in a list, use the contains block. This block will return True or False
True means that the item is in the list. False means that the item is not in the list.