Python Forum
Combine Or and And in If Statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combine Or and And in If Statement
#4
(Jul-22-2021, 06:50 PM)jefsummers Wrote: Parenthesis can help break this into segments for you. I think this is what you want
if ('AH' in mStrip or 'MH' in mStrip) or ('GL' in mStrip and not 'ML' in mStrip):
I was thinking this instead:
if ('AH' in mStrip or 'MH' in mStrip or 'GL' in mStrip) and not 'ML' in mStrip:
But that just shows that a string of and and or statements is bad code.
Reply


Messages In This Thread
Combine Or and And in If Statement - by JamesA - Jul-22-2021, 10:18 AM
RE: Combine Or and And in If Statement - by deanhystad - Jul-22-2021, 07:06 PM
RE: Combine Or and And in If Statement - by JamesA - Jul-24-2021, 12:26 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020