-2
def scene3():
    print("After you defeated the Giant Spider you encounter a Dark Dragon do you want to Attack or Run:? ")
    encounter = input("Do you want to attack the Dragon?: [Attack/Run]")

    if encounter.strip().lower() == "Attack":
        print("You Attack the Dark Dragon and DIED apparently this rare monster is to much for you game over")
        quit()

    elif encounter.strip().lower() =="Run":
        print("You successfully outrun the Dark Dragon and landed in a Capital City in Magical World")
        time.sleep(delay2)

output:

After you defeated the Giant Spider you encounter a Dark Dragon do you want to Attack or Run:? 
Do you want to attack the Dragon?: [Attack/Run]run

Process finished with exit code 0
Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52
Cris Uy
  • 13
  • 2
  • 2
    You lower case a string and then check against strings with upper case. Try changinge "Attack" to "attack" and etc. – tdelaney Aug 31 '22 at 03:57
  • Well, yes, because "attack" exits the program. Right? – Tim Roberts Aug 31 '22 at 04:00
  • Just do `encounter = encounter.strip().lower()` once, then compare `encounter` to `"attack"` and `"run"`, etc. – Tim Roberts Aug 31 '22 at 04:01
  • Another hint: According to Pythons documentation [`quit`](https://docs.python.org/3/library/constants.html#quit) is useful for the interactive interpreter shell and should not be used in programs. – Matthias Aug 31 '22 at 06:07

1 Answers1

-1

Your if and else condition should check for string with lowercase when using lower.().

Please change the code to this:

import time

delay2 = 5

def scene3():
    print("After you defeated the Giant Spider you encounter a Dark Dragon do you want to Attack or Run:? ")
    encounter = input("Do you want to attack the Dragon?: [Attack/Run]")

    if encounter.strip().lower() == "attack":
        print("You Attack the Dark Dragon and DIED apparently this rare monster is to much for you game over")
        quit()

    elif encounter.strip().lower() == "run":
        print("You successfully outrun the Dark Dragon and landed in a Capital City in Magical World")
        time.sleep(delay2)

scene3()

O/P:

$ python3 test.py
After you defeated the Giant Spider you encounter a Dark Dragon do you want to Attack or Run:?
Do you want to attack the Dragon?: [Attack/Run]attack
You Attack the Dark Dragon and DIED apparently this rare monster is to much for you game over

$ python3 test.py
After you defeated the Giant Spider you encounter a Dark Dragon do you want to Attack or Run:?
Do you want to attack the Dragon?: [Attack/Run]run
You successfully outrun the Dark Dragon and landed in a Capital City in Magical World
tenacity
  • 456
  • 1
  • 5
  • 14
  • 1
    Thank you so much it also solves my problem i need to change the string in lower case "Attack" - "attack" Thank you. – Cris Uy Aug 31 '22 at 04:05
  • Please read [answer] and don't answer questions that boil down to simple typos, as they are [off topic](https://stackoverflow.com/help/on-topic). – Karl Knechtel Aug 31 '22 at 05:30