Screen Link:
I got the same exact output in solutions, but wont let me submit answer?
from csv import reader
file = open('restaurants.csv')
reader = csv.reader(file)
restaurants_csv = list(reader)
restaurants={}
for row in restaurants_csv[1:]:
neighborhood = row[1]
if neighborhood in restaurants:
restaurants[neighborhood]+=1
else:
restaurants[neighborhood]=1
# list out keys and values separately
key_list = list(restaurants.keys())
val_list = list(restaurants.values())
#solution for number 3
most_restaurants = ''
maximum = val_list[0]
for value in val_list:
if value > maximum:
maximum = value
most_restaurants+=key_list[val_list.index(maximum)]
#print(maximum)
print(most_restaurants)
What I expected to happen:
Prints Downtown
What actually happened:
Downtown