-1

For some reason when I run this code it doesn't want to execute the function, I get no error messages or output. But the weird part is I've tested the first block of code before the multiple_account_scan() function and it does what I want it, the problem seems to be the second part, where it decides whether or not default_list is True or False. I honestly don't know what to do here as there are no error messages.

message_response = ['/V/M/itechexplore, techcrunch, technology', 'ndjakdjna', 'edouhadas', 'sduahjkdan']

for message in message_response:

    if '/V/M/' in message:
        pre_account_list = []
        multiple_account_scan_accounts = message.removeprefix("/V/M/")

        pre_account_list.append(multiple_account_scan_accounts)

        for message in pre_account_list:
            if "," in message:
                pre2_account_list = message.split(", ")

        default_mode = False

    if '/V/M/R/' in message:
        default_mode = True


def multiple_account_scan():
    print('my brain is high IQ')


try:
    if default_mode is True or False:
        multiple_account_scan()
except:
    print('No option inputted')
azro
  • 53,056
  • 7
  • 34
  • 70
Buddy
  • 13
  • 3

1 Answers1

1

The if default_mode is True or False isn't right, that means

  • either default_mode is True
  • either False which is always False

It's equivalent to if default_mode is True


Then if no matter it would be True or False you go into the if, that means you always go, or the purpose if to use the fact that the variable won't defined and you'll go in the except

Do

if default_mode in [True, False]:
    multiple_account_scan()
# or
if default_mode is True or default_mode is False:
    multiple_account_scan()
azro
  • 53,056
  • 7
  • 34
  • 70