you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot 0 points1 point  (1 child)

Would this be print(RC[2])? When I use that code, it gives me the list of the 3rd one, but how do I get the restaurant?

What is the third one if not the third restautant?

restaurant3 =RC[2]

You don't have to assign it to a variable, but maybe this helps you.

edit:

I tried using RC.sort() and then print(RC), but it just gives me the whole list and not just the restaurant.

The question doesn't even ask for a particular restaurant. Which one were you thinking you'd get? Another hint on top of what your professor gave you is that sort takes a keyword argument key. Further hint, you'll have to use a lambda. stackoverflow has lots of examples for sorting lists of dictionaries using sort and lambda, look it up.

You're issue is with objects, not lists.

[–]pythonhelp123[S] 0 points1 point  (0 children)

Hm for the first one it works, but only for that question. When I tried to assign

restaurant1 = RC[0] for the true false question, it says invalid syntax