Explain it if you can | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Jan 2020, 8:03 PM
Anay Sah
Anay Sah - avatar
6 Answers
+ 11
print function doesn't return a value. A function that "does not return a value" returns None. Thus None was assigned to variable x. type "function" returns the class of an object. Thus type(None) returns the class of None and the class of None was printed. (type is not actually a function, it is also a class, it is the class of classes)
23rd Jan 2020, 8:12 PM
Seb TheS
Seb TheS - avatar
+ 11
when you write: x = print ("y") The variable x then points to the result of the function call: print("y"). And print is a function which returns nothing (=None) You would get the same result doing: def f(n): pass x = f("y") print(x)
23rd Jan 2020, 8:18 PM
Cépagrave
Cépagrave - avatar
+ 10
help(print) clears the case. print is a function that returns None.
23rd Jan 2020, 8:22 PM
Oma Falk
Oma Falk - avatar
+ 1
Lol why would you even do that??? A print function shouldn't be used inside a variable.
23rd Jan 2020, 8:13 PM
Sajid
Sajid - avatar
+ 1
In python every function returns something even if it does not have a return keyword.Those without the return value return None.Print method is one of those.You can see that its class is NoneType
25th Jan 2020, 11:35 AM
John
John - avatar
+ 1
It is easy First you need to nude yourself Then lay down on the bed Remember: You need to get some oil and lay down in opposite direction Then someone comes And take feeling of ghapa ghap (Bsdk angrezi or npmat jaiyo)
26th Jan 2020, 5:22 PM
Sagar Kumar
Sagar Kumar - avatar