I am drawing a blank on this one too. Rather than provide an answer, I would appreciate if someone could help me understand why my code is not printing the expected output:
def bool_to_str(bval):
if bval is True:
mytest = 'Yes'
else:
mytest = 'No'
return mytest
Expected output:
>>>bool_to_str([1, 2, 3])
'Yes'
>>>bool_to_str(abcdef)
'Yes'
What's actually output:
>>>bool_to_str([1, 2, 3])
'No'
>>>bool_to_str(abcdef)
'No'
Please help me to understand what I did wrong. I think that the function needs to test the actual truth value of the argument, but I don't understand what I'm missing.