If you want to make a clarification or explain something, you can write a comment in Python. If you start the line with a hashtag # or three apostrophes ‘‘‘, Python knows that this is not part of your code and does not execute it.
What do you need comments for?

Do you understand what it is supposed to mean? It is less than 10 lines of code.
Now look at this code with some explanations.

Basically, comments are just supposed to make your life easier for when you try to understand your code later on and of course for others who might need to look at your code.
When to use which type of comment?
You may have noticed that Thonny fades out comments started by # and displays comments between ”’ in green (like text). This is not the only difference between them.
#: valid for the rest of the line
- advantage: only one symbol necessary
- disadvantage: automatically blocks out the rest of the line; if necessary, you need to repeat it in the next line
‘’’ [text] ‘’’: valid until closed
- advantage: you determine the start and the end (works in the middle of a line and for multiple lines)
- disadvantage: you need three symbols each time (if you forget one, it will not work); you need to close it
In general, I agree with the website Python for Beginners – very useful, by the way – that recommends to think “of the first type as a comment for yourself, and the second as a comment for others”.
So from now on, just add comments to your code whenever necessary! #mastery02
Great Insights. Thanks for sharing
LikeLike