+ 1
#Using print instead of return , gives output none in last line
#Using print instead of return , gives output none in last line. def add_numbers(x, y): total = x + y return total print("This won't be printed") print(add_numbers(4, 5))
2 Answers
+ 1
If you want return value, you may think using that,
print (add_numbers (4, 5))
Otherwise, if you will print something inside function, do that,
add_numbers(4, 5)
Every function in python returns something whether it be a value or None.
+ 1
The line with âthis wont be printedâ wont be prinzed, because after the return statement the function ends....