11. Neighborhood with most restaurants

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
1 Like

Do not use function name as variable. reader is function in csv library. I don’t no where but it must be get conflict in answer checking system.

So give any other name than reader ex. file_reader

file_reader = csv.reader(file)
restaurants_csv = list(file_reader)

After changing it should pass the mission.