Added lecture 2026113

This commit is contained in:
Edward Bigos 2026-11-03 12:49:45 -05:00
commit 5b630435ae
27 changed files with 738 additions and 0 deletions

View file

@ -0,0 +1,34 @@
#!/usr/bin/python3
# List operating as a stack.
dogNames = [ "harry", "Shenanigans","katrina","Tanner","Yukon Jack", "Colorado","Mandy"]
dogNames2 = ["Oscar", "Rusty"]
firstNames = ["edward","david", "Bob","mary","alice"]
intList = [7, 2, 12, 18, 16, 21]
primeList = [1, 2, 3, 7, 11, 13, 17, 19]
txtList = ["7", "2", "12", "18", "16", "21"]
print("pop() can be used to implement a stack. A stack is a last in first out")
print(" (LIFO) structure used in some program logic.")
print (dogNames," length = ",len(dogNames))
dName = dogNames.pop()
print(f"Popped {dName:s}")
print (dogNames," length = ",len(dogNames))
dName = dogNames.pop()
print(f"Popped {dName:s}")
print (dogNames," length = ",len(dogNames))
dName = dogNames.pop()
print(f"Popped {dName:s}")
print (dogNames," length = ",len(dogNames))
print("\n\n")
print("There is no push but we can append")
dogNames.append("Colorado")
print (dogNames," length = ",len(dogNames))