the for loop on line will go through each line that was read from the level file one line at time the line number will be stored in linenum and the string of text for the line will be stored in line any newline characters at the end of the string will be stripped off if ';in lineignore the linesthey're comments in the level file line line[:line find(';')any text that exists after semicolon in the map file is treated like comment and is ignored this is just like the sign for python comments to make sure that our code does not accidentally think the comment is part of the mapthe line variable is modified so that it only consists of the text up to (but not includingthe semicolon character (remember that this is only changing the string in the content list it is not changing the level file on the hard drive if line !''this line is part of the map maptextlines append(linethere can be maps for multiple levels in the map file the maptextlines list will contain the lines of text from the map file for the current level being loaded as long as the current line is not blankthe line will be appended to the end of maptextlines elif line ='and len(maptextlines blank line indicates the end of level' map in the file convert the text in maptextlines into level object when there is blank line in the map filethat indicates that the map for the current level has ended and future lines of text will be for the later levels note howeverthat there must at least be one line in maptextlines so that multiple blank lines together are not counted as the start and stop to multiple levels find the longest row in the map maxwidth - for in range(len(maptextlines))if len(maptextlines[ ]maxwidthmaxwidth len(maptextlines[ ]all of the strings in maptextlines need to be the same length (so that they form rectangle)so they should be padded with extra blank spaces until they are all as long as the longest string the for loop goes through each of the strings in maptextlines and updates maxwidth