+ 1
Is print a keyword in python
Iam a begineeršš
19 Respostas
+ 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 :)
+ 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
+ 3
Print was a keyword in Python 2 but has become a function in Python 3.
+ 2
print(25 + 25) #prints 50
print("25" + "25") #prints 2525
Its not a keyword, andriy kan corrected me.
+ 2
So basically print is not a keyword, but it is predefined function which is inbuilt....
So, you would understood from that..ššš
+ 2
Any thing that contains () brackets are called function
+ 1
Well thanks sweety
+ 1
Thanks andriy
+ 1
Come on both of you i got it.
+ 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.
+ 1
No its a function
+ 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.
0
MR. PROGRAMMER lol np
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.
0
Print is not a keyword in Python. It is a statement.
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...
0
What's th difference between pyrhon2 and python3??.I only know of python.
0
It's not a keyword. It's a default function to print a line in console.
0
It's a built-in function.