Link to home
Start Free TrialLog in
Avatar of dfernan
dfernanFlag for United States of America

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.
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial