Help with Print skipping Python

I’m making a Tower-of-Doom like game and while trying to fix the battles, despite there being a time.sleep(5) and text supposed to print, an entire print statement is not only skipped, but the code calculating effect is skipped. Not sure why this is happening.

userInput = input()
      if userInput.lower() == "str":
        print(f"""You chose a STRENGTH attack

Enemy Abilities:
Enemy Strength: {eCardStr}
Enemy Intelligence: {eCardInt}
Enemy Charisma: {eCardCha}
Enemy Health: {eHealth}""")
        if pCardStr > eCardStr:
          print("We win the battle.")
          eHealth -= pCardStr - eCardStr
          print(f"We dealt {pCardStr - eCardStr} damage.")

could you clarify which print statement is skipped?

I would recommend using the builtin debugger to go through your code.
Place a breakpoint before the relevant section of code and step line by line to see what is happening.

It’s everything after the if userInput.lower() == “str”: in the code snippet that’s inside the loop.

Found the issue. == and > statements for if userInput == “str”: weren’t done so it skipped it.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.