I know it's a basic question but please bear with me. Let's say if we have 4 strings below:
a = ''
b = 'apple'
c = 'orange'
d = 'banana'
So, normally if I want to check if any of the three string a
b
c
is empty, I could use len()
function.
if len(a) == 0 or len(b) == 0 or len(c) == 0:
return True
But then I thought it is too troublesome to write like above if I have many strings. So, I used
if not a:
return True
But, when i am checking for multiple strings b
c
d
using the above method, it returns True
and I am puzzled as non of the strings b
c
d
where empty.
if not b or c or d:
return True
What is going on?