Menu Close

Python print() Function

Here we will learn Python’s most important Python print() function that is used to print the specified message on the screen.
In previous Python built-in functions tutorials, we have seen lots of functions along with examples.
the print function in Python is the most useful function that is used to print some message or print the value of the variable on the screen.

Python print() function

Python print function in Python is a built-in function that is used to print a specified message or print the value of the specified variable on the screen.

Syntax

The syntax of print function in Python is:-

print(object(s), sep=separator, end=end, file=file, flush=flush)

Parameters

print function in Python support various parameters, which describe below.

  • object(s):- Any object, and as many as you like.
  • sep:- separator, Specify how to separate the objects.
  • end:- Optional. Specify what to print at the end.
  • file:- Optional, An object with a write method.
  • flush:- Optional, A boolean. Specifying is the output is flushed (True) or buffered ( False ). Default is False.

Python print functions examples

Here we will go through some examples to understand Python print function.

Example 1:

#Print simple one object.
print('Welcome to Programming Funda')

#Print more than one object.
print('Welcome to', ' Programming ', 'Funda')

#print variable value.

a = 12
b = 23
print(f"The Addition of {a} and {b} is:- {a+b}")

Output

Welcome to Programming Funda
Welcome to  Programming  Funda
The addition of 12 and 23 is:- 35

Example 2:

Use print function with second parameter that is sep.

#print more than one object with sep parameter.
print('Welcome to', ' Programming ', 'Funda', sep='---')

Output

Welcome to--- Programming ---Funda

Example 3:

Use print function with end parameter.

#print more than one object with end parameter.
print('Welcome to', end=' ')
print('Programming ', 'Funda.')

Output

Welcome to Programming Funda.

Conclusion

In this tutorial, you have learned all about Python print function along with examples.
This is the most popular and usable function to print specified objects.
If you are a Python programmer, Then we don’t need to explain more because the print function is used day by day.

If you like this article, please share and keep visiting for further Python built-in functions tutorial.

Python built-in functions

For more information:- Click Here

Previous Article
Next Article

Was this post helpful?

Related Posts

Leave a Reply