Python Comments

Comments in Python

Comments are the lines which are skipped during execution of a program. There are two types of comments available in python.

First one is single line comment which starts with ‘#’ symbol and extends till the end of line. Comments can start from the beginning of the line and middle of the line, but it should not be a part of string literal.

Second one is multi line comment which starts with ‘ ‘ ’ or “ “ ” and ends with ‘ ’ ’ or “ ” ” respectively. Which is mainly used for documentation purpose.

Syntax
//Program Example :
‘ ‘ ’
	used for: Demonstrating comments 
	This is the first way of using multi-line comment
	'''

	“ “ ” 
	used for: Demonstrating comments 
	second way of using multi-line comment

	“ ” ”
CODE/PROGRAM/EXAMPLE
#program to demonstrate explicit type conversion 

	num1=10 #variable of integer type
	num2=“20” #variable of string type
	result=num1+int(num2) #using explicit conversion 
	print(result)
	
Output:
	30
#python_comment #Comments_in_Python #python_multiline_comment #python_comment_block #multiple_line_comment_in_python #comment_multiple_lines_in_python #python_comment_syntax #python_comment_line #multiple_comments_in_python

(New page will open, for Comment)

Not yet commented...