dfernan
asked on
If Condition with Strings
Hi,
Very short question.
I want to check this condition.
list = ['3', '5', '8']
if list[0] != NA & list[0] != NA & list[0] != NA:
print 'No NAs'
else:
print 'there is at least one NA'
But i get the following error:
TypeError: unsupported operand type(s) for &: 'str' and 'str'
What's the shortest way to do what i want to do without nested if else???! don't wanna use nested if else.
Very short question.
I want to check this condition.
list = ['3', '5', '8']
if list[0] != NA & list[0] != NA & list[0] != NA:
print 'No NAs'
else:
print 'there is at least one NA'
But i get the following error:
TypeError: unsupported operand type(s) for &: 'str' and 'str'
What's the shortest way to do what i want to do without nested if else???! don't wanna use nested if else.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.