Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.


Code Samples: Membership Testing, Count, and Index

List & Tuples

Membership Testing

fruits = ['apple', 'banana', 'orange', 'pear', 'strawberry']
vegetables = ('asparagus', 'corn', 'broccoli', 'eggplant', 'onion')

'eggplant' in fruits # False
'eggplant' not in fruits # True

'eggplant' in vegetables # True
'eggplant' not in vegetables # False


my_pets = ('dog', 'cat', 'cat', 'chicken',...