Python print statement | Python multiline comment: Python is a simple language with respect to any other programming language. Even, if you’re a beginner and you don’t understand any programming language. You’ll be able to conjointly be aware of it terribly clearly as a result of its syntax is far easier than the other programming language. Now we are going to learn how to use the Python print statement and Python multiline comment in Python 3.

Python Print Statement
Python Print Statement

Python print statement (Hello World Program)

Python print statement is used to print the statements or values of variables on the screen. Suppose we want to print statements “Hello world”. we are able to write straightforward as

print ("Hello world!")

The Python print statement will also be used to print multiple lines whether in an exceedingly single performance or single Program.

name1 = "Computer"
print ( name1 )
name2 = "Physics"
print ( name2 )
name3 = "Math"
print ( name3 )

We don’t use any other statements or syntax (Don’t use the semi-colon at the end of every statement like other programming languages) to print Hello World! That’s why Python is an easy language.

Python multiline comment 

How to use a Python comment?

Comments are used as a hint of a line or program to make it easier to know. They don’t affect other codes of the program. we tend to use hash (#) to write down any comment line in Python Programming. Everything that you simply write after the hash(#) symbol will be neglected by the compiler.

# How to use Comments?
name = " Python may be a straightforward language "
print ( name ) #print statement is used to print the value of name variable.
#In Python, the comment is formed by inserting an octothorpe ( otherwise identified hash symbol: # )

Python does not have multiline comments that are used in several alternative languages like C and C++ etc.

Python multiline comment in Python 3
Python multiline comment in Python 3

How to use Python multiline comment?

In Python multiline comment, we can use a method to use multiline comments in Python which is the Docstring method. Are you interested in learning about Docstring? Yeah, that’s not a problem. Let’s start…

Python Docstring

In Python, Docstring stands for document string that serves as for Python multiline comment. Let us take an example to use a Docstring. See the following below example.

name="my name is ABDUL JABBAR"
""" let we take an example of Docstring
that is used for multiline comments."""
OutPut: my name is ABDUL JABBAR

Some Useful Links

Python vs. PHP performance | Which language is better for web development?

Django vs. Flask | Which framework is best in Python Web Development?

Categorized in: