-1

I want to simplify this statement in python.

if string=='M' or string=='m' or string=='Male':
      print "OK"
srccode
  • 677
  • 4
  • 15

1 Answers1

2

Try this:

if string in ["M", "m", "Male"]:
    print "OK"
picmate 涅
  • 3,603
  • 5
  • 40
  • 48