Suvitruf
0
Q:

python comment block

# 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.
5
def increase_salary(sal,rating,percentage):
    """ increase salary base on rating and percentage
    rating 1 - 2 no increase
    rating 3 - 4 increase 5%
    rating 4 - 6 increase 10%
 
    """
11
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
6
# put # before each line
0

New to Communities?

Join the community