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