Lecture 11/17/2026
This commit is contained in:
parent
07b9e54bf0
commit
bf3265103a
44 changed files with 1195 additions and 3 deletions
29
lecture20261117/while/names2.py
Normal file
29
lecture20261117/while/names2.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
print("Process fNames")
|
||||
|
||||
fNames = [ "Harry Bigos", "Moe Howard", "Katrina Smith", "Colorado Jones", "Shenanigans Davis", "Tracey 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]))
|
||||
counter = counter + 1
|
||||
|
||||
print("Process list - sorted - but doesn't work right")
|
||||
|
||||
fNames.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]))
|
||||
counter = counter + 1
|
||||
|
||||
print("Problem: How do we sort both lists and keep the first and last names together.")
|
||||
print("One solution: Redefine the data.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue