Added lecture 2026113
This commit is contained in:
parent
be356ccb59
commit
5b630435ae
27 changed files with 738 additions and 0 deletions
14
lecture20261103/lists02/lists06-membership.py
Normal file
14
lecture20261103/lists02/lists06-membership.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue