Building a commuter program for Vancouver commuters

Welcome to the Get Help category!

This is where you can ask questions about your code. Some important things to remember when posting in this category :slight_smile:

  • Learn how to ask a good question and get a good answer!
  • Remember to include a link to the exercise you need help with!
  • If someone answers your question, please mark their response as a solution :white_check_mark:
  • Once you understand a new concept, come back and try to help someone else!

so I am done with this project but for some reason when I type r and r I get this error, can anyone tell me what it is?

here’s the error

Traceback (most recent call last):
File “skyroute.py”, line 117, in
skyroute()
File “skyroute.py”, line 19, in skyroute
new_route()
File “skyroute.py”, line 65, in new_route
shortest_route = get_route(start_point, end_point)
File “skyroute.py”, line 94, in get_route
shortest_route = min(routes, key=len)
ValueError: min() arg is an empty sequence

The error message is pretty specific.

If you look at line 94 of your code:

shortest_route = min(routes, key=len)

the error is telling you that routes is empty. The question then, is why was nothing appended to the empty list? Well, what is the route from point r to point r? That is one of the bonus features you can add. Obviously you don’t need to ride the metro from a station to the same station, so you probably want to add some code for how to handle this edge case.

image

1 Like

but how do I stop the error, is it fine like that or what part should I check?

You just have to add logic to handle a case when a user inputs the same destination as the starting point.

1 Like