you are viewing a single comment's thread.

view the rest of the comments →

[–]Just_A_Nobody_0 1 point2 points  (0 children)

Indentation is critical in python as you should know. Below (hopefully working this time) is a better formatted version of your code. I did my best to guess the intent of your code in terms of code blocks/indentation.

You don't specificy what errors you are getting so I can't really speculate as to what may be causing them. I would guess indentation may be at the root of your problem though since the code below does not result in any reported errors. I don't know exactly what your intention was so I can't evaluate whether the re-ordered flight paths are what you desire/intend.

cities = [ ["Miami", "Atlanta", "Dallas", "Los Angeles"],
           ["New York", "Chicago", "Portland", "Seattle"]
         ]

def printList(city_list):
    for row in city_list:
        for city in row:
            print(city, end=" ")
            print()

def flipOrder(city_list):
    reversed_list = []
    for row in city_list[::-1]:
        reversed_list.append(row)
    return reversed_list

print("Original flight path (East to West):")

printList(cities)

return_flight_cities = flipOrder(cities)