Final answer:
To solve this problem, you need to create a 2D list with the given cities. First, write a printList() function that takes the list as a parameter and prints it. Then, create a flipOrder() function that reverses the order of each sublist in the original list.
Step-by-step explanation:
To solve this problem, you need to create a 2D list with the given cities. First, write a printList() function that takes the list as a parameter and prints it. Then, create a flipOrder() function that reverses the order of each sublist in the original list. At the end of this function, call printList() again to print the reversed list. This will give you the desired output of the cities in the original order and the reversed order.
Example:
def printList(city_list):
for sublist in city_list:
for city in sublist:
print(city, end=' ')
print()
def flipOrder(city_list):
for sublist in city_list:
sublist.reverse()
printList(city_list)
# Create the 2D list
list_of_cities = [['Miami', 'Atlanta', 'Dallas', 'Los Angeles'], ['New York', 'Chicago', 'Portland', 'Sacramento']]
# Call printList() to print the original list
printList(list_of_cities)
# Call flipOrder() to print the reversed list
flipOrder(list_of_cities)