-1

I want to simplify this statement in python.

if string=='M' or string=='m' or string=='Male':
      print "OK"
srccode
  • 721
  • 4
  • 16

1 Answers1

2

Try this:

if string in ["M", "m", "Male"]:
    print "OK"
picmate 涅
  • 3,951
  • 5
  • 43
  • 52