popularity = [5,3,5,4,5]
city = [1,0,2,1,2]
target = 5

answer = [0,0,0] 

for i in range(len(popularity)):
    if popularity[i] == target:
        answer[city[i]] += 1

print(answer)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: