Python: Почему я получаю синтаксический аргумент в предложении If, если синтаксис кажется хорошим? - PullRequest
0 голосов
/ 11 марта 2020

Я знаю, что они могут быть другим вопросом, подобным этому, на сайте, но я нашел много из них, и они не помогают мне решить мою проблему. Я в python 3

Вот мой код:

  global IND_Names, amount_led, percent_led, amountled_clear, TEST, modeselect_clear
  while not modeselect_clear:
    modeselected = str(input("Do you want the default mode(d), the kids mode(k), or the custom mode(c)?")).upper()
    if modeselected == "D" or modeselected == "K" or modeselected == "C" or modeselected == "TESTRUN":
      modeselect_clear = True
      pass
    else:
      error = 1
      print("INPUTERROR, Input has incorrect format [{}]".format(modeselected))
    return

  print("You have selected: {}!".format(modeselected)

  if modeselected == "D":
    amount_led = 3
    percent_led = (10/3)*10
  elif modeselected == "K":
    amount_led = 1
    percent_led = 50
    pass
  elif modeselected == "C":
    while not amountled_clear:
        amount_led = int(input("How many LED Indicators do you need in the bomb? (Between 1 and 5)"))
        if (amount_led > 0) and (amount_led < 6):
            amountled_clear = True
        else:
            print("Input error: Format incorrect!")
  elif modeselected == "TESTRUN":
    TEST = True
    pass
  naamloos(IND_Names, amount_led, percent_led)

В строке, которая гласит if modeselected == "D":, мой иде дает мне Ошибка синтаксиса. Я не могу найти решение ... Может ли кто-нибудь мне помочь?

...