Python Output Using print() Function:

The print() function is the simplest way to produce an output in python while using it in data science or in general. In it, we can pass zero or more expressions separated by commas. This function converts the passed expression into a string and then writes on the screen.

Output using print function in Python for Data Science - PST Analytics

Code 1: Using print() function in Python 2.x

# Python 2.x program showing

#how to print data on

# a screen

#One object is passed

print “PSTAnalytics”

#Four objects are pass

print “PST”, “Analytics”

l = [1, 2, 3, 4, 5]

# printing a list

print l

Output:

PSTAnalytics

PST Analytics

[1,2,3,4,5]

Code 2: Using print() function in Python 3.x

#Program showing

#how to print data on

# a screen in python for data science

#One object is passed

print(“PSTAnalytics”)

x = 4

# Two objects are passed

print(“x =”, x)

# code for disabling the softspace feature

print(‘P’, ‘S’, ‘T’, sep =”)

# using end argument

print(“Python”, end = ‘@’)

print(“PSTAnalytics”)

Output:

PSTAnalytics

X  =  4

PST

Python@PSTAnalytics

To learn more about it, you can check this and this.

Leave a Reply

Your email address will not be published. Required fields are marked *