On 2014.10.01 17:37, Shiva wrote:
> Only 'None' gets passed on to parameter 'got' instead of the expected value
> of 4.
> Any idea why 'None' is getting passed even though calling the donuts(4)
> alone returns the expected value?
donuts() prints what you tell it to ("Number of donuts: 5"), and then returns
what you tell it to (nothing).
If you don't explicitly make a function return something, it returns None.
Whatever other logic you have in the function is irrelevant.
--
https://mail.python.org/mailman/listinfo/python-list
- Function passed as an argument returns none Shiva
- Re: Function passed as an argument returns none Andrew Berg
- Re: Function passed as an argument returns none Chris Kaynor
- Re: Function passed as an argument returns none Mark Lawrence
- Re: Function passed as an argument returns none Shiva
- Re: Function passed as an argument returns none Chris Angelico
- Re: Function passed as an argument returns none Denis McMahon
- Re: Function passed as an argument returns none Rustom Mody
- Re: Function passed as an argument returns none Chris Angelico
- Re: Function passed as an argument returns none Steven D'Aprano
