How To Use Print() Function in Python

How To Use Print() Function in Python



The print() function prints the specified message to the screen or other standard output device.      

The message can be a string or any other object, the object will be converted into a string before being written to the screen.

Example:

message = 'Python is fun'

# print the string message
print(message)

# Output: Python is fun

Example 1: How print() works in Python?

print("Python is fun.")

a = 5
# Two objects are passed
print("a =", a)

b = a
# Three objects are passed
print('a =', a, '= b')

Output

Python is fun.
a = 5
a = 5 = b

Post a Comment

Previous Post Next Post