Python Forum
2 if statements happening at the same time
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 if statements happening at the same time
#2
Please use python tags to protect your code when posting code. Otherwise the formatting is lost.

Your if statement is parsed this way:
if (action == "/cash") or ("/money"):
Non-empty strings (like "/money") are always true, so this conditional will always evaluate to true.

You probably intend something like one of the below:
if action == "/cash" or action == "/money":

if action in ["/cash", "/money"]:
BliepMonster likes this post
Reply


Messages In This Thread
RE: 2 if statements happening at the same time - by bowlofred - Nov-19-2022, 10:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb What's happening here? jesse68 3 1,062 Feb-27-2023, 04:53 PM
Last Post: Gribouillis
  Why is this happening? taner7 3 2,315 Oct-14-2020, 10:11 PM
Last Post: Skaperen
  Binding not explicitly declared happening karkas 4 3,069 Aug-05-2019, 05:09 PM
Last Post: karkas
  Why this python ValueError is not happening aurquiel 2 3,153 Aug-20-2018, 07:17 PM
Last Post: aurquiel
  Something strange happening here !? TerryRitchie 4 4,044 Apr-20-2017, 07:14 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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