python how to comment out a block code example
Example 1: how to make a comment python
# You use a hastag at the beginning of the line to make anything after it a comment
'''
You can also make a multi line comment
With three single quotes at the beginning and end!
'''
Example 2: python big comment
# one hashtag for a single line comment
"""
3 quote marks is technically
a docstring, but it works as
a multi line comment
"""
##pressing 'Alt 3' in IDLE comments out
##what you are selecting
and 'Alt 4' to uncomment
if False:
print('Hello') # yes you can do it at the end of a line
you can technically put if False around code you dont want it to run,
but that would mean it has to have correct syntax,
and would not be good for readability.
Example 3: comment out a block in python
select the lines you want to comment
and 'use Ctrl + / to comment all of the selected text'.
To uncomment do the same thing.
OR
put a '#' before each line
eg : #This is a comment
Example 4: python comment block
"""
this
is
a multiline
comment
"""
Example 5: big comments python
# One line Comment
myvar = 5 # Can also start after any chunk of code
"""
Big multiple lines comment
So many lines
WoW
"""