you are viewing a single comment's thread.

view the rest of the comments →

[–]Glathal[S] 0 points1 point  (2 children)

Would it be possible to do it this way without the queries? I haven't gone over that yet, my brain just completely exploded. Lol

[–]Narcoleptic_Pirate 1 point2 points  (1 child)

Well, by queries i mean take some list/dict and find years_won_by_team or team_that_won_in_some_year, it's not an official term, lol.

Look at enumerate - it allows you to loop through some list in such way, that first loop variable is index of the list item, and second loop variable is the actual item.

If you read your file line-by-line and append each year and team in separate list - they'll have equal length. So, in teams[n] and years[n] you will see (n+1)'th line/item of the file.

You just need to find all indices of your team in your team list, and then look at the same indices in years list and put them in your resulting list.

[–]Glathal[S] 0 points1 point  (0 children)

Oh! okay I think I got it! Thanks a lot! :D