Hi, some help with Exercise 1: Listing pineapple routes

I’m implement this code but the test give me some error, some help please:

import itertools portnames = ["PAN", "AMS", "CAS", "NYC", "HEL"]

def permutations(route, ports):

ports.remove(route)

permuts = itertools.permutations(ports)

for i in permuts: output = [route] + list(i)

# Print the port names in route when the recursion terminates

print(' '.join(output)) # this will start the route with 'PAN' as the first stop

permutations(portnames[0], portnames)

When I run it, seems to me be a good solution:

PAN AMS CAS NYC HEL
PAN AMS CAS HEL NYC
PAN AMS NYC CAS HEL
PAN AMS NYC HEL CAS
PAN AMS HEL CAS NYC
PAN AMS HEL NYC CAS
PAN CAS AMS NYC HEL
PAN CAS AMS HEL NYC
PAN CAS NYC AMS HEL
PAN CAS NYC HEL AMS
PAN CAS HEL AMS NYC
PAN CAS HEL NYC AMS
PAN NYC AMS CAS HEL
PAN NYC AMS HEL CAS
PAN NYC CAS AMS HEL
PAN NYC CAS HEL AMS
PAN NYC HEL AMS CAS
PAN NYC HEL CAS AMS
PAN HEL AMS CAS NYC
PAN HEL AMS NYC CAS
PAN HEL CAS AMS NYC
PAN HEL CAS NYC AMS
PAN HEL NYC AMS CAS
PAN HEL NYC CAS AMS


Thanks for some advise!