There are two ways to place comments in Python code.
Single line comments
A comment that takes up a single line can be written after a "#" character:
# Comment
If the comment is used to explain a singular command, it can be placed on the same line right after it:
ev3.speaker.play_file(SoundFile.BOING) # Plays the sound "BOING"
Multi-line comments
If we wish to use more than one line for a comment, we can place it in between a pair of three double quotes:
"""
Comment
Comment
Comment
"""
The first three double quotes mark the beginning of the comment. If the code does not have another three double quotes, then the program will treat the rest of the code as a comment and will not execute it.
Many programmers mark parts of their code as comments when they want to temporarily switch it of without deleting it.