2026fa_cse160/lecture20261110/listmethods/list10MethodReverse.py

24 lines
511 B
Python

#!/usr/bin/python3
# Program: list09MethodReverse.py
programMessage = '''
This program reverses a list.
'''
print(programMessage)
# Lists of text values
dogNames = [ "Harry", "Shenanigans","Katrina","Tanner","Yukon Jack", "Colorado","Mandy"]
# Print the list and the length
print("Print the length and type of the list.")
print (dogNames," length = ",len(dogNames),"Type =",type(dogNames))
print("\nReverse the list")
dogNames.reverse()
print("Print the length of the reversed list.")
print (dogNames)