How do you write comments in python?
A single line comment can be added by using the hash (#)
character. The hash (#)
is added for every line that should be commented.
Example:
#This is a comment
print("Hello")
Additional information
Python does not have a way to add multiline comments because it doesn’t have multiline commenting support, with others languages like Java or C++ you can do it and the program will ignore the whole block.
In Python you can create multiline comments like this:
# Adding
# multiple
# lines of code
When you are using this kind of comment you only need use capital letter in the firts line of code.