Mystery (None) after printing a function, which prints a variable. Why is it there? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Mystery (None) after printing a function, which prints a variable. Why is it there?

PY Printing a function, why is there a "None" at the end? https://code.sololearn.com/cJ4C9gF9lSnN/?ref=app

2nd Aug 2020, 6:18 PM
Mika Hämäläinen
Mika Hämäläinen - avatar
2 Answers
+ 3
Mika Hämäläinen Summary is this + what codemonkey has said: if your code has a return output, you call it with a print() else if it has a print output, call it without the print. Example: def func(): print("yes") func() def func2(): return "yes" print(func2()) Happy Coding 😀😀
2nd Aug 2020, 6:41 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 1
Thx codemonkey and Tomiwa Joseph I"ll try to remember this. 🤓
2nd Aug 2020, 7:02 PM
Mika Hämäläinen
Mika Hämäläinen - avatar