Question: Extracting the ranking Create a new function that will return a variable named rankings, which is a list of dictionaries set up as follows: rankings

Extracting the ranking
Create a new function that will return a variable named rankings, which is a list of dictionaries set up as follows:
rankings[i] is a dictionary corresponding to the restaurant whose rank is i+1. For example, from the screenshot above, rankings[0] should be a dictionary with information about Gus's World Famous Fried Chicken.
Each dictionary, rankings[i], should have these keys:
rankings[i]['name']: The name of the restaurant, a string.
rankings[i]['stars']: The star rating, as a string, e.g.,'4.5','4.0'
rankings[i]['numrevs']: The number of reviews, as an integer.
rankings[i]['price']: The price range, as dollar signs, e.g.,'$','$$','$$$', or '$$$$'.
Of course, since the current topic is regular expressions, you might try to apply them (possibly combined with other string manipulation methods) find the particular patterns that yield the desired information.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!