Friday, 10 February 2023

Comments in Python

Comments in Python 

Comments in python are not executed by the python interpreter. Comments help to understand the code in an easy way. There are two types of comments in python

  1. Single line comments
  2. Multiline comments

Single line comments

Single line comments are indicated using the the symbol Hash(#) . The single line comments last till the end of the line.

#sinle line comments
#Organization
org='tutorialtpoint'
owner='Dodda Venkat Reddy'
print('The organization is',org,'and the owner is',owner,'.')

Output

The organization is tutorialtpoint and the owner is Dodda Venkat Reddy .
  

Multiline comments

Python does not support multiline comments but by using the Hash symbol in every line we achieve it.
#Multi-line comment
#comments can be written in more than one lines
a=input('Enter a string:')
print(a)

Output

Enter a string:Hello world
Hello world

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top