Oshadha Wrote: It is important that when returning a value, always return it as a variable, and not a line of code
This really isn't a correct thing to say at all. First, returning the value of any kind of expression is perfectly fine. An expression is something that can be evaluated to produce a value: examples are: a function call as in the OP's example, a literal (like
123
or "foo"
, or a variable.The problem is that the
print
function returns None
- since its job is to print to the screen, it doesn't make sense for it to return any meaningful value.