Added code for lecture 2026-11-10

This commit is contained in:
Edward Bigos 2026-11-10 12:28:09 -05:00
commit 07b9e54bf0
52 changed files with 1248 additions and 1 deletions

View file

@ -0,0 +1,33 @@
# https://www.w3schools.com/python/python_ref_list.asp
# https://www.quackit.com/python/reference/python_3_list_methods.cfm
programMessage = '''
The count() method counts the number of elements in a list.
'''
print(programMessage)
basicList = [1, 34, 99, 87, 14, 1, 34, 1,87 ]
print(f"Example list {basicList}")
myValue = 1
counter = basicList.count(myValue)
print(f"The number of '{myValue}' items is {counter}")
myValue = 34
counter = basicList.count(myValue)
print(f"The number of '{myValue}' items is {counter}")
myValue = 87
counter = basicList.count(myValue)
print(f"The number of '{myValue}' items is {counter}")
myValue = 314
counter = basicList.count(myValue)
print(f"The number of '{myValue}' items is {counter}")