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 “”, line 117, in
File “”, line 19, in skyroute
File “”, line 65, in new_route
shortest_route = get_route(start_point, end_point)
File “”, 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.


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

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.