2026fa_cse160/lecture20261103/lists02/lists06-membership.py
2026-11-03 12:49:45 -05:00

14 lines
463 B
Python

#!/usr/bin/python3
# List membership.
dogNames = [ "harry", "Shenanigans","katrina","Tanner","Yukon Jack", "Colorado","Mandy"]
firstNames = ["edward","david", "Bob","mary","alice"]
print(firstNames)
# A match is found.
print("Is david in firstNames ? ",'david' in firstNames)
# Matches are case sensitive
print("Is David in firstNames ? ",'David' in firstNames)
# harry is not in the list of firstNames
print("Is harry in firstNames ? ",'harry' in firstNames)