Hi,
I am learning Python (version 3.4) strings.I have a function that takes in a
parameter and prints it out as given below.
def donuts(count):
if count <= 5:
print('Number of donuts: ',count)
else:
print('Number of donuts: many')
return
It works fine if I call
donuts(5)
It returns:
we have 5 DN (as expected)
However if I do :
test(donuts(4), 'Number of donuts: 4')
where test is defined as below:
def test(got, expected):
print('got: ', got, 'Expected:' ,expected)
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print (('%s got: %s expected: %s') % (prefix, repr(got), repr(expected)))
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?
Thanks,
Shiva.
--
https://mail.python.org/mailman/listinfo/python-list