Is print a keyword in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is print a keyword in python

Iam a begineer😃😃

26th Mar 2020, 11:34 AM
MR. PROGRAMMER
MR. PROGRAMMER - avatar
19 Answers
+ 1
Yeah i know what u did, you first stored it in a, but u know what i was trying to say, i was trying to answer simply, thats why, as he said, hes a beginner, he wouldn't have understood storing reference, but you are completely right :)
26th Mar 2020, 12:44 PM
maf
maf - avatar
+ 3
MR. PROGRAMMER , maf Actually, print is not keyword in Python. It is builtin function. And you can define variable with name print: a=print print = 3 a(print * 5) https://code.sololearn.com/cWvJtWgHIcNC will output 15
26th Mar 2020, 12:25 PM
andriy kan
andriy kan - avatar
+ 3
Print was a keyword in Python 2 but has become a function in Python 3.
26th Mar 2020, 1:34 PM
HonFu
HonFu - avatar
+ 2
print(25 + 25) #prints 50 print("25" + "25") #prints 2525 Its not a keyword, andriy kan corrected me.
26th Mar 2020, 11:36 AM
maf
maf - avatar
+ 2
So basically print is not a keyword, but it is predefined function which is inbuilt.... So, you would understood from that..😊😊😄
27th Mar 2020, 10:20 AM
Rathod Kelvin
Rathod Kelvin - avatar
+ 2
Any thing that contains () brackets are called function
28th Mar 2020, 5:34 AM
Wade
Wade - avatar
+ 1
Well thanks sweety
26th Mar 2020, 11:39 AM
MR. PROGRAMMER
MR. PROGRAMMER - avatar
+ 1
Thanks andriy
26th Mar 2020, 12:26 PM
MR. PROGRAMMER
MR. PROGRAMMER - avatar
+ 1
Come on both of you i got it.
26th Mar 2020, 12:29 PM
MR. PROGRAMMER
MR. PROGRAMMER - avatar
+ 1
maf, you will get an error because you try to call variable 'print' which is not a function anymore and has integer type after assignment: print(print) but print=5 will not get any error!!! See my code above. I store reference to print in variable a, and then call a with variable print multiplied by 5. You can run it.
26th Mar 2020, 12:41 PM
andriy kan
andriy kan - avatar
+ 1
No its a function
28th Mar 2020, 5:33 AM
Wade
Wade - avatar
+ 1
In python 3 some new module in comparison to python2. Most syntax are same .ot is eazier to convert python 2 to python3 and python 3 is better than python2.
28th Mar 2020, 2:49 PM
Wade
Wade - avatar
26th Mar 2020, 11:39 AM
maf
maf - avatar
0
andriy kan you will get an error if u write print = 5 print(print) And yeah it is a built in function, i was trying to explain it in his words, coz it would have probably confused him like functions and methods.
26th Mar 2020, 12:27 PM
maf
maf - avatar
0
Print is not a keyword in Python. It is a statement.
27th Mar 2020, 4:13 PM
Sri Ram Sai Pavan Relangi
0
It's a function n we write it as print() similar to one which u used in c(printf()) for displaying data on d screen...
28th Mar 2020, 5:10 AM
Arshiya Jabeen
0
What's th difference between pyrhon2 and python3??.I only know of python.
28th Mar 2020, 9:21 AM
A.N Maxwell
0
It's not a keyword. It's a default function to print a line in console.
28th Mar 2020, 10:17 AM
Jay Prakash Pathak
Jay Prakash Pathak - avatar
0
It's a built-in function.
28th Mar 2020, 11:32 AM
Sigma
Sigma - avatar