+ 1

Why there's "None" at the end of result ?

1. I have defined a fonction as bellow: def joe_sum(x,y): return print("result is: "+str(x+y)) 2. And I run it: print(joe_sum(1,2)) 3. I get result: result is: 3 None 4. My question: Why there's a "None" at the end of result ?

23rd Mar 2019, 9:47 PM
Joe Lishuai Lin
Joe Lishuai Lin - avatar
1 Odpowiedź
+ 6
Because print() doesn't return anything at section 1. def joe_sum(x,y): return "result is: "+str(x+y)
23rd Mar 2019, 9:54 PM
Toni Isotalo
Toni Isotalo - avatar