Code lines in the books are restricted in order to avoid requiring the reader to horizontally scroll to see all of the code. This means that some lines wrap differently between the source and books, which is unfortunate when trying to compare them.
Revisit the book line lengths for source code, adjusting with CSS or other means. Then reformat the source code to the same line length.