Why Are Comments Important in Code?

Compare the two programs below:

 

Example 1 Not using comments:

 

x, y = peek(79456, 79457)

print(x, y)

 

 

 

Example 2 Using comments:

 

# retrieves the current location of the mouse pointer on the screen

# x contains the x coordinate and y contains the y coordinate

x, y = peek(79456, 79457)

 

# provide the coordinates to the user

print(x, y)

 

Even though the above code is pseudo code, it is plain even to non-programmers what the purposes of the statements are.