When I type in the following statement in idle print(print("print")) I'm getting the following result :"print" in line 1 and "none" in line 2. why is none there in the output?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When I type in the following statement in idle print(print("print")) I'm getting the following result :"print" in line 1 and "none" in line 2. why is none there in the output??

17th Sep 2016, 10:13 PM
ABHISHEK SHARMA
ABHISHEK SHARMA - avatar
4 Answers
+ 7
Because print() doesn't return anything, so the outer print() evaluates the value of its parameter as none.
17th Sep 2016, 10:42 PM
Zen
Zen - avatar
+ 1
you forgot to wrap the inner print in single quotes.
18th Sep 2016, 1:22 AM
Adrian Bertea-Toth
Adrian Bertea-Toth - avatar
+ 1
You have to type print('print("print")'). You forgot the '-s. Without this the 2 print() counts as 1.
18th Sep 2016, 8:19 AM
Wætrb4II
Wætrb4II - avatar
0
@adrin if you wrap outer print by ' ' you'll get diffrent o/p 'print("print")
3rd Dec 2016, 11:23 PM
Biswascoder
Biswascoder - avatar