Hi, I'm processing a small text file which contains information about the Winter Olympics. However I don't know how to keep the list the same for each country whilst making a new list for a different country.
So far I've read in the lines and I have put the data the following code:
country = ["Germany","Germany","Italy"] #e.g German gets Gold and Silver and Italy gets a bronze
medals = ["Gold","Silver","Bronze"]
event = ["Luge men's single"]
x = []
temp = {}
data = {}
for i in range(len(country)):
x.append(medal[i])
temp[event] = x
data[countries[i]] = temp
The data structue I want to create is:
{"country":{"event name":[medals],... "event name2":[medals] } }
If I put x=[] and the end of the for loop, it just returns the last medal.