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,18 @@
myList = [ 7, 5, 3, 9.5 ,11, 9999, "bob"]
print("The list is ",myList)
print("The type is ",type(myList))
print("The length is ", len(myList) )
print("\n")
counter = 0
while(counter < len(myList)) :
print(f"{counter} {myList[counter]} \t{type(myList[counter])}")
counter = counter + 1

View file

@ -0,0 +1,27 @@
myList = [ 7, 5, 3, 9,11]
print("The list is ",myList)
print("The type is ",type(myList))
print("The length is ", len(myList) )
print("\n")
for dummy in myList:
print(f"{dummy:3d} {dummy**2:4d} {dummy**3:5d}")
print("Done!")
for listElement in myList:
print(f"{listElement:3d} {listElement**2:4d} {listElement**3:5d}")
print("Done!")
for x in myList:
print(f"{x:3d} {x**2:4d} {x**3:5d}")
print("Done!")

View file

@ -0,0 +1,18 @@
myList = [ 7, 5, 3, 9]
print(myList)
print(type(myList))
print( "Length of the list is ",len(myList) )
print(myList[0])
print(myList[1])
print(myList[2])
print(myList[3])
# This generates an error when you uncomment it
#print(myList[4])

View file

@ -0,0 +1,8 @@
firstNames = [ "Harry", "Rusty", "Katrina", "Jack", "Gimli","Shenanigans", "Mandy"]
print(firstNames)
print("The length is ",len(firstNames))
for firstName in firstNames:
print(firstName)

View file

@ -0,0 +1,14 @@
firstNames = [ "Harry", "Rusty", "Katrina", "Jack", "Gimli","Shenanigans", "Mandy"]
print(firstNames)
print(len(firstNames))
for firstName in firstNames:
print(firstName)
firstNames.sort()
print(firstNames)
for firstName in firstNames:
print(firstName)

View file

@ -0,0 +1,11 @@
powersList = [0,1,2,3,4,5,6,7,8,9,10]
# Try this form
#powersList = range(0,11)
print("The list is ", powersList)
for n in powersList:
powerOfTwo = 2**n
print(f"{n:2d} {powerOfTwo:8d}")