where does the print() subroutine, subprogram, or function exist?
sure, you "call" it so it can return a value or result, but from where? from where do you "call" it? where does it exist?

i don't understand!!

Recommended Answers

All 2 Replies

In python 2x, print is a statement, not a subroutine, subprogram, or function.
Hence it exists as part of core language. That is, it is integrated as part of interpreter.

In python 3, print is a function which is found in builtins module (but I am not sure since I don't use python 3)

The function print() is part of the core of Python (Python25 and Python30)

It simply prints to the console what you put into its parameter:

print(2 + 3)
pi = 355/113.0
print(pi)
print("pi = %0.4f" % pi)
print('Helen')
print('')
s1 = 'Jim is '
x = 24
s2 = ' years old'
print(s1 + str(x) + s2)
print('-'*20)

"""
my output -->
5
3.14159292035
pi = 3.1416
Helen

Jim is 24 years old
--------------------
"""
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.