def isBig(x):
if x > 4:
return \'apple\'
else:
return \'orange\'
This works:
if isBig(y): return isBig(y)
The problem is that the assignment operation cannot be evaluated as having a boolean value. The if
statement relies on being able to evaluate a boolean. For example,
>>> fruit = 'apple'
>>> bool(fruit = 'apple')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/jem/ in ()
TypeError: 'fruit' is an invalid keyword argument for this function
>>> bool('a')
True