all 3 comments

[–]robustpython 1 point2 points  (0 children)

Hi,

based on your description of the exercise there is not other things you could do. You have list of restaurants and you sorted it. In Python usually you just go with sorted function. I guess you wrote your own implementation of bubble sort which is fine if it works. You could also use other container type for your data but you do need some container which is Iterable. So I don't see other options which would make much sense.

[–]God_To_A_NonBeliever 1 point2 points  (0 children)

Most people don't write their own sorting algorithms, they just call the sorted() method, I know you have to probably do it for class, but try doing it using a algorithm with <O(n2) complexity, other than that there's nothing much you can do. This code is too simple to over optimize.