22 lines
668 B
Python
22 lines
668 B
Python
#!/usr/bin/python3
|
|
# Program: list02
|
|
|
|
# Lists of text values
|
|
dogNames = [ "Harry", "Shenanigans","Katrina","Tanner","Yukon Jack", "Colorado","Mandy"]
|
|
firstNames = ["edward","david", "Bob","mary","alice"]
|
|
|
|
|
|
# Print the list and the length
|
|
print("Print the length of the lists.")
|
|
print (dogNames," length = ",len(dogNames))
|
|
print(firstNames," length = ",len(firstNames))
|
|
print("\n")
|
|
|
|
# Another way to think of the for loop is to read it as
|
|
# "Select the next element from the list, put it into the variable
|
|
# item, the do whatever you like with that one value in item".
|
|
# The for loop ends when the entire list has been processed.
|
|
|
|
for item in dogNames:
|
|
print(item)
|