yt

Header Ads

Python Comments and Explaination - Technology369kk

Python Comments :

  1. Python comments we are using for explain code. 
  2. Python comments we are using for make the code more readable.
  3. Python comments we are using for prevent execution when testing code. 
So as a human-readable explanations that are ignored by the python interpreter during execution.
 

Type of Python Comments:

1.Single-line comments:  

  • Begin with a hash symbol (#) 
  • Everythinf after the # on the same line is considered a comment
# This is a single-line comment
x = 5  # This is an inline comment'
print(x)

2.Multi-line comments:  

  • Actually Python does not reconised multiline comments but if you want to use one to more line for not execute in program then you can use for them (#) symbols for each line one by one. 
  • Such as 


# <<<This is a Multi-line comment
# <<<only using # symbols such current using
# <<<In this line  
x = 5
y= 20
z= x+y
print(z)

Or 
  • Otherwise if you want to use one place then use triple quotes( """  write something """)
  • We can achieve multi-line comments by using single triple quotes or by double triple quotes.
  • Let's see an example:  

"""
<<<This is a Multi-line comment
<<<only using # symbols such current using
<<<In this line  """  
x = 5
y= 20
z= x+y
print(z)



Note:  Guys if you want to text all code, pls visit my git-hub account :  Click >>  github.com

No comments

Theme images by Dizzo. Powered by Blogger.