I am trying to define a function which takes a string argument and yields 1
if the string is a, c, e or g and yields 0
if the string is b, d, f or h.
def ifodd_str(col):
if col == 'a' or 'c' or 'e' or 'g':
return 1
elif col == 'b' or 'd' or 'f' or 'h':
return 0
ifodd_str('a')
The problem is ifodd_str('b')
returns 1
. What is wrong with my if statements?