Mystery (None) after printing a function, which prints a variable. Why is it there? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 RĂ©ponses
+ 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