Lecture 11/17/2026
This commit is contained in:
parent
07b9e54bf0
commit
bf3265103a
44 changed files with 1195 additions and 3 deletions
32
lecture20261117/while/names1.py
Normal file
32
lecture20261117/while/names1.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
print("Process fNames")
|
||||
|
||||
fNames = [ "Harry", "Moe", "Katrina", "Colorado", "Shenanigans", "Tracey"]
|
||||
lNames = [ "Bigos", "Howard", "Smith", "Jones", "Davis", "Carter"]
|
||||
counter = 0
|
||||
|
||||
|
||||
print("\nThe length of the list is {}\n".format(len(fNames)))
|
||||
|
||||
while(counter < len(fNames) ):
|
||||
print("Counter = ",counter)
|
||||
print("fNames[{}] = {}".format(counter,fNames[counter]))
|
||||
print("lNames[{}] = {}\n".format(counter,lNames[counter]))
|
||||
counter = counter + 1
|
||||
|
||||
print("Process list - sorted - but doesn't work right")
|
||||
|
||||
fNames.sort()
|
||||
lNames.sort()
|
||||
counter = 0 ;
|
||||
|
||||
|
||||
print("\nThe length of the list is {}\n".format(len(fNames)))
|
||||
|
||||
while(counter < len(fNames) ):
|
||||
print("Counter = ",counter)
|
||||
print("fNames[{}] = {}".format(counter,fNames[counter]))
|
||||
print("lNames[{}] = {}\n".format(counter,lNames[counter]))
|
||||
counter = counter + 1
|
||||
|
||||
print("Problem: How do we sort both lists and keep the first and last names together.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue