Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

multiline comment python

# While Python doesn't support multi-line comments, it can ignore anything
'''
inside a multi-line string!
Just wrap the comment in the three single quote marks,
And
you're
good
to
go!
'''
Comment

python multiline comment

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%
 
    """
Comment

python multiline comment

#%% There are not multiline comments in python,
# this # is the only form of commenting but, people use
# """triple quotes""" for multiline commenting but this
# is actually a String the interpreter will read and 
# will ocupy memory. If you dont put this kind of string
# into a variable it will be collected on execution
Comment

multiple comment line in python

'''
This is a multiline
comment.
'''
Comment

multiline comment in python

# This a comment
#Or This
#For a comment written in more than a line
#You just add triple quotes without assigning it a variable or putting it in a
#print statement
'''
Like This
But only for Python
As far as i know
'''
Comment

multiline comment in python

# Python is a language that doesn't support multiline comments
# In languages like JS, single line comments have // in the beginning
# and multiline comments have /* in the beginning
# and */ in the end
# the pound symbol in front of these five lines is the python equivalent of //
print("But there is a workaround!!!")
"""
In python, multiline string is written with 3 double or single quotes, 
and the characters in between are treated as an entire string
but, if this string isn't assigned to a variable, python doesnt give any error
It instead ignores the string, similar to the behaviour it would have 
towards a comment. 
BUT!!!!!
If this is string is put just after defining a function, it is treated as a 
docstring, or the documentation string of that function. So, it does have a 
meaning and is not exactly ignored by Python
"""
def someFUnc():
  """
  Python will treat this as a docstring
  """
  pass

print(someFUnc.__doc__)

# OUTPUT:
#   Python will treat this as a docstring
Comment

Example of Single-line comment in Python

Example of Single-line comment in Python
# This is a single line comment example
print("Hello World")
Comment

python multi-line comments

"""
This is a string written over
more than one line
"""

print("Hello, World!")
Comment

python multiline comment

'''
Some
Text
'''
# or
"""
some
text
"""
Comment

Multi-line comments Python Example

Multi-line comments Example
# This is how we can acheive 
# Multi-line comments in Python
print("Hello World")
Comment

Single line Commenting in Python

#This line won't be printed
Comment

python single line comment

# Comment on a single line
 
user = "JDoe" # Comment after code
Comment

How to add a single line comment in python

# This is a Python single-line comment and it will be ignored
Comment

python single-line comments

# Comment on a single line

name = "Pied Piper" # Comment after code
Comment

python multi-line comments

# This is a comment written over
# more than one line

print("Hello, World!")
Comment

PREVIOUS NEXT
Code Example
Python :: string concatenation in python 
Python :: how to make a list in python 
Python :: how to duplicate a column pandas 
Python :: join string with comma python 
Python :: Create list of unique values from dictionary 
Python :: # extract images from pdf file 
Python :: remove columns that start with pandas 
Python :: how to create qrcode in python 
Python :: any function in python 
Python :: python install graphviz and 
Python :: bot delete embed py 
Python :: how to test value error in pytest in python 
Python :: Python Read the CSV file 
Python :: np.hstack in python 
Python :: filter query objects by date range in Django 
Python :: pandas in python 
Python :: python regex validate phone number 
Python :: python save picture in folder 
Python :: load specific columns dataframe 
Python :: python gui kivvy 
Python :: views django 
Python :: python *args and **kwargs 
Python :: symmetrical sum python 
Python :: python save image pytelegrambotapi 
Python :: telegram.ext package 
Python :: python open aspx file 
Python :: pandas turn column of list into binary 
Python :: automatic regex generator python 
Python :: torch distributed address already in use 
Python :: python manual elif 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =