Please help me fix my code im stuck. Please and thank you

import random
import time  # import time for time.sleep

from colorama import Fore, Style  # Used to color text

tele = False
# Determines the chance at the end to slip off or not
min = 1
max = 2
def randint(min, max):
    num = random.randint(1, 2)
    return num
NAMEE = input("Whats your name?")
print("\n *Flash back* ")
time.sleep(2)
print("/-------------------\\ ")
print("( Dear " + NAMEE + "             )")
print("(  We are sorry to  )")
print("(infrom you that you)")
print("(have been drafted  )")
print("(to war. We need you)")
print("( -USA Goverment    )")
print("\\-------------------/")
time.sleep(5)
print("\n *Pew* *Pew* ")
print("NOOOOOO")
print("\n *Goes into a deep coma* ")
time.sleep(5)
print(f"{Fore.GREEN}You wake up from your coma and realize you are stuck in a dungeon!{Style.RESET_ALL}")
print("[:::::=======:::::]")
print("[:::::( 0 0 ):::::]")
print("[:::::(  -  ):::::]")
print("[:::::( --- ):::::]")
print("[:::::=== ===:::::]")
print("[:::::::| |:::::::]")
print("[::::---| |---::::]")
print("[:::::::/ \\:::::::]")
print("   -(That's You)-   ")
print("You have to find a way out to survive.")
FOYOD = input("Do you want to 1. Yell for the guard 2. Flush yourself down the toilet or 3. disassemble the toilet: ")
if FOYOD == "1":
    print("You yell for the guard and he hears you.")
    print("Out of anger for waking him up from his nap he shoots you.")
    print("Gameover! Please start again")
elif FOYOD == "2":
    tele = True  # If FOYOD is 2, assigning True to tele
elif FOYOD == "3":
    print("You disassemble the toilet and find a key and a knife. Which one do you take?")
    KOK = input("1. Key 2. Knife: ")
    if KOK == "1":
        print("You pick up the key and realize it has a toxin in it. Later that day you die.")
        print("Gameover! Please start again")
    elif KOK == "2":
        print("You pick up the knife and you can do 2 things.")
        KYSOW = input("1. Stab yourself so you don't suffer or 2. stab the wall: ")
        if KYSOW == "1":
            print("You stab yourself and die. WHAT WERE YOU THINKING?!?!?!?!?!?!?!")
            pprint(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
        elif KYSOW == "2":
            print(f"{Fore.RED}You stab the wall and it reveals a tunnel!{Fore.WHITE}")
            TON = input("Do you 1. Go into the tunnel or 2. stay in your cell: ")
            if TON == "2":
                print("You stay in your cell but the guard comes by and sees you with a knife. He then shoots you.")
                print("Gameover! Please start again")
            elif TON == "1" or tele:
                print("You flush yourself down the toilet and it reveals a tunnel")
                print("You go into the tunnel and it reveals two pathways.")
                LOO = input("Do you 1. Go left or 2. Go right: ")
                if LOO == "2":
                    print("You go right but another guard sees you and shoots you.")
                  print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
                elif LOO == "1":
                    print("You go left and you find a chest.")
                    print("You open the chest and find a cannon sword.")
                    PPP = input("Do you 1. Take the sword or 2. Leave the sword: ")
                    if PPP == "1":
                        print("You take the sword and you fight the guard.")
                        print("You fight the guard and you win!")
                    elif PPP == "2":
                        print("You leave the sword and you fight the guard.")
                        print("You lose badly. You get destroyed by his AK47.")
                      print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")

if tele is True:
    print("You flush yourself down the toilet but more guards sees you")
FOR = input("Do you 1. Fight them or 2. Try to run away: ")
if FOR == "1":
    print("You attempt to fight back but you get shot.")
  print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
game_over = True
elif player_score > 21:
print("You went over 21. You lose.")
      print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
      print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")

if __name__ == "__main__":
                 blackjack()
else:
                 print("You grab the wrong rock and slip off, falling to your death.")
print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
exit()

What error are you receiving?

Indent,Syntax,Traceback

Ran out of AI quota and im to poor to buy pro

There were a lot of random undefined variables, and a lot of strange extras (like a name = main that was randomly placed), and lots of indentation errors. Here is the corrected code:

import random
import time  # import time for time.sleep

from colorama import Fore, Style  # Used to color text

player_score = 0
tele = False
# Determines the chance at the end to slip off or not
min = 1
max = 2
def randint(min, max):
    num = random.randint(1, 2)
    return num
NAMEE = input("Whats your name?")
print("\n *Flash back* ")
time.sleep(2)
print("/-------------------\\ ")
print("( Dear " + NAMEE + "             )")
print("(  We are sorry to  )")
print("(infrom you that you)")
print("(have been drafted  )")
print("(to war. We need you)")
print("( -USA Goverment    )")
print("\\-------------------/")
time.sleep(5)
print("\n *Pew* *Pew* ")
print("NOOOOOO")
print("\n *Goes into a deep coma* ")
time.sleep(5)
print(f"{Fore.GREEN}You wake up from your coma and realize you are stuck in a dungeon!{Style.RESET_ALL}")
print("[:::::=======:::::]")
print("[:::::( 0 0 ):::::]")
print("[:::::(  -  ):::::]")
print("[:::::( --- ):::::]")
print("[:::::=== ===:::::]")
print("[:::::::| |:::::::]")
print("[::::---| |---::::]")
print("[:::::::/ \\:::::::]")
print("   -(That's You)-   ")
print("You have to find a way out to survive.")
FOYOD = input("Do you want to 1. Yell for the guard 2. Flush yourself down the toilet or 3. disassemble the toilet: ")
if FOYOD == "1":
    print("You yell for the guard and he hears you.")
    print("Out of anger for waking him up from his nap he shoots you.")
    print("Gameover! Please start again")
elif FOYOD == "2":
    tele = True  # If FOYOD is 2, assigning True to tele
elif FOYOD == "3":
    print("You disassemble the toilet and find a key and a knife. Which one do you take?")
    KOK = input("1. Key 2. Knife: ")
    if KOK == "1":
        print("You pick up the key and realize it has a toxin in it. Later that day you die.")
        print("Gameover! Please start again")
    elif KOK == "2":
        print("You pick up the knife and you can do 2 things.")
        KYSOW = input("1. Stab yourself so you don't suffer or 2. stab the wall: ")
        if KYSOW == "1":
            print("You stab yourself and die. WHAT WERE YOU THINKING?!?!?!?!?!?!?!")
            print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
        elif KYSOW == "2":
            print(f"{Fore.RED}You stab the wall and it reveals a tunnel!{Fore.WHITE}")
            TON = input("Do you 1. Go into the tunnel or 2. stay in your cell: ")
            if TON == "2":
                print("You stay in your cell but the guard comes by and sees you with a knife. He then shoots you.")
                print("Gameover! Please start again")
            elif TON == "1" or tele:
                print("You flush yourself down the toilet and it reveals a tunnel")
                print("You go into the tunnel and it reveals two pathways.")
                LOO = input("Do you 1. Go left or 2. Go right: ")
                if LOO == "2":
                    print("You go right but another guard sees you and shoots you.")
                    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
                elif LOO == "1":
                    print("You go left and you find a chest.")
                    print("You open the chest and find a cannon sword.")
                    PPP = input("Do you 1. Take the sword or 2. Leave the sword: ")
                    if PPP == "1":
                        print("You take the sword and you fight the guard.")
                        print("You fight the guard and you win!")
                    elif PPP == "2":
                        print("You leave the sword and you fight the guard.")
                        print("You lose badly. You get destroyed by his AK47.")
                        print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")

if tele is True:
    print("You flush yourself down the toilet but more guards sees you")
FOR = input("Do you 1. Fight them or 2. Try to run away: ")
if FOR == "1":
    print("You attempt to fight back but you get shot.")
    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
    game_over = True
elif player_score > 21:
    print("You went over 21. You lose.")
    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")
else:
    print("You grab the wrong rock and slip off, falling to your death.")
    print(f"{Fore.RED}GAME OVER!!!! YOU LOSE{Style.RESET_ALL}")

If this solves your problem, please mark this post as the solution!

1 Like

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