From f0377992390e8c013129c378a05bf023215da46e Mon Sep 17 00:00:00 2001 From: Uma2197 <124685592+Uma2197@users.noreply.github.com> Date: Sun, 21 Apr 2024 10:43:25 +0200 Subject: [PATCH] Name, Cuisines, Rating and Address Update main.py Adding in the Rating and Address datapoint to the display: Tapping into the "starRating" key in order to display the ratings as a number Formatting the address to my desired way of display. --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index ded13a2..b5612ec 100644 --- a/main.py +++ b/main.py @@ -15,8 +15,11 @@ def display_restaurant_info(data): for restaurant in data: name = restaurant['name'] cuisines = ", ".join([cuisine['name'] for cuisine in restaurant['cuisines']]) + rating = restaurant['rating']['starRating'] + address = f"{restaurant['address']['firstLine']}, {restaurant['address']['postalCode']}, {restaurant['address']['city']}" - print(f"Name: {name}\nCuisines: {cuisines}") + print(f"Name: {name}\nCuisines: {cuisines}\nRating: {rating}\nAddress: {address}\n") display_restaurant_info(restaurant_data) +