I suggest the following improvements
- The dictionary has the scores as keys and the teams as values, they want switching so the teams are the keys and the scores are the values.
- The first line from the text file you want to skip over it as its a header, to do this you can use next on
info_outputfile
- 'liverpool' in the file is lower case l, 'Liverpool' in the dictionary has upper case L, one or the other must change so they match.
- There is one too many loops, remove the last one
- Change the line split variable from
l
toelement
- The list indexes are wrong for the last two items from the split.
- The error shown does not match the code shown.