Ask coding questions

← Back to all posts
How do i know where to fix my indentations, pls?
JeffreyKeppler (0)

I am making a text game and it always says errors on it about the indentations?

CatPaw11 (1)

#Narrative time
print("Hello Aeten one, what sort of class do you choose for your desperate journey")
print("Here are the classes")
classes = ['Knight', 'Sourcerer', 'Viking', 'Madman']
classes = input()

if classes.lower() == "knight":
print("Wise choice for a strong man, off on your journey, rememeber to not fall of ledges")
elif classes.lower() == "sourcerer":
print("Good choice too, you will be able to attack affar")
elif classes.lower() == "viking":
print("Use the force you must!! strong you are with the haxe")
elif classes.lower() == "madman":
print("FOOOL!!! You will die with that!!!!!, enter at your own death")
print("Get out of here!!!")
print("Ready to embark on your journey?")
ready = input()
if ready.lower() == "yes":
print("Off you go!, remember to fly to the Sock of Power")
elif ready.lower() == "no":
print("What more can I do for a Huddletuff person?")

print("Off the powerful person goes on his journey to the dark forest, the character finds a mysterious Kangeroo")
print("The charecter has several options")
print("To fight it or let it run off")
action_1 = input()
if action_1.lower() == "fight":
print("The Kangeroo evolves into a giant 5 legged Jigglypuff, decked out in shining black armor")
print("He attacks with his legs and goes about to swipe at you, dodge or jump")
action_2 = input()
if action_2.lower() == "dodge":
print(" You jump on the head, and take the massive creature with a swift strike")
print(" A soul comes out of nowhere, you take it and continue your journey through the woods")
print("You walk up the the casalt, where an entire army is found waiting for you outside the gate")
print("Should you leave or fight")

action_3 = input()
if action_3.lower() =="leave":
print("You leave distraught and sad, suddenly you realize that you can through a lightning bolt at the casalt, you grap the bolt and blow the entire casalt up!")
print("You return home, with half a journey complete and able to tell the story")
print("THE END")
elif action_3.lower() =="fight":
print("You start fighting the soldiers, though they overwhelm you resulting in your death")
print("YOU DIED")
elif action_2.lower() == "jump":
print("You die INSTANTLY")
print("You got squashed!")
#Run path
elif action_1.lower() == "run":
print("The Kangeroo helps you and leads you through a back entrance 1")
print("You part ways after saying Goodbye 3 ")
print("Inside their lays the king, sitting in his marvlivean metal throne 4")
print("You realize that your bow is out of range, so you have to either sneak up or create a distraction")
choice_4 = input()
if choice_4.lower() == "sneak" or"sneak up":
print("You take your knife and walk straight inside, a guard passes by you, should you kill him or let him pass. Your call 2")
choice = input()
if choice.lower() == "kill" or "kill him":
print("You pop up behind him landing a blow to the neck. You see the armor fits your size, should you wear it to get closer? 8")
choice = input()
if choice.lower() == "yes" or "wear it":
print("You put on the shiny heavy armor, while hiding the body.")
print("You walk down the stairs and before you can get there a guard pushes you in direction to the barracks 6")
print("The guard pushes you into a room filled with other soldiers, you are in the Lions Den.")
print("You quickly merge with the group of soldiers, losing your superior")
print("You have a chance to go after the King, do you risk it?")
option = input()
if option.lower() == "Yes":
print("You rush out and find a group of soldiers walking in direction of the king, you follow them and make a swift right 9")
print("You explore and then find a chamber, a lock stands in your way.")
print("Only way to pass is by writing a 8 digit code with a riddle")
print(" It says,'You have seen it, though have you remember it? Look back to the dawn of your day, for where that is where it is located?")
print("The final number is your class minus your class")
print("Do you remember what the code is?")
option = input()
#Enter correct code
if option.lower() =="13428690":
print("You have done it")
print("You enter inside, where the king lies on his throne, unseen from everyone")
print("You sneak up and stab the King through the throne with your mighty sword of Flymoore")
print("He collapses on the throne, you make your daring escape back through the way you came")
print("A group of soldiers have heard the door opened and enter the room finding their king dead, they sound the alarm")
print("With that you rush out, you find the stairs that you entered the casalt from, though it is blocked")
print("You can go through the front door or climb your way out?")
option = input()
if option.lower() == "front door":
print("You rush out the front door and make it away from the casalt, though a group of hunters spot you")
print("Unknowingly, they shoot their weapons at you, resulting in your death")
print("You run to the top floor, a door is open with a stealth plane barely visible to be seen")
print("You board the plane, though you find that you need a verified hand print")
print("All of a sudden the door opens downstairs with the pilot entering")
print("You can kill him and use his hand or let him start the plane and take it over after")
decision = input()
if decision.lower() == "kill him" or "kill":
print("You take out the pilot, use his hand and escape from the Casalt with your life, you make it back home in the invisible plane")
print("Your journey is completed, though this is only the beginning of the adventure")
print("Though for now you have survived and completed your mission")
print("<CONGRATULATIONS PILOT> Mission Completed")
elif decision.lower() == "let him start the plane" or "start":
print("You hide behind a panel, the pilot boards the plane and starts the engine")
print("You take off, though your armor rattles around and the pilot finds out what your plan is")
print("You fight, though the plane goes down killing both of you")
print("Your luck has just ran out")
print("The world goes into black")
print("You died")
print("The alarm goes off, the entire squad of soldiers runs to your position")
print("You have nowhere to hide, the squad finds you and instandly swarms your also meloncholy soul")
print("They remove your helmet and take you back to the king, where he the King takes out his Demon's Scar and stabs you")
print("Your body begins to burn and you turn into ash instantaniously")
print("The then take your ashes and throw them out into the ravine of the abyss watchers")
print("You DIE, while being tortured alive down in the deep dark ravine")
if option.lower() == "no":
print("You follow the squad of soldiers and set foot on the out skirts of the castle where everyone marchs out for their 50 mile journey to prove their worth")
print("You unnoticeably follow, you walk on and realize your fate will be ruined with each dredded step on this dark dense path")
print("Suddenly, a few soldiers are thrown off the road in to the dredded forest by a Marguar")
print("Giving you the chance to escape")
print("You jump off the road, and crawl slowly back to the casalt, but is greeted by archers armed with iron arrows, you flee back home")
print("You were close, though the journey is over, you get some sick armor and live the rest of your life")
print("You stay and soon the enemies find out who you are, you die on the spot")
if choice.lower() == "pass":
print("You let him pass")
print("From there you sneak on top of the King and shoot your bow down on the Worthy one")
print("The arrow reaches through the head, though as soon as the Worthy one crumbles to the ground")
print("Soldiers spot you and without you noticing they shove you over the railing")
print("You are dead")
print("You sit there and a solider passes by and spots you, he takes you out")
if choice.lower() =="distraction":
print("You throw a smoke, though the smoke alarm goes off")
print("The soldiers take the king and bring him to the safe room")
print("In that time you throw down a happy charm")
print("Everyone starts dancing till they collapse")
print("You escape with a mission completed")

Theres your fixed code some of the story is messed up so you willl have to fix it but you dont have to indent under elase and stuff that remains on the same line as the if

Link to new code:

let me know if you need anytyhing else

JeffreyKeppler (0)

@CatPaw11 I have a question, some of the paths that I have created I want the if statement to be shown if that text is said, same for elif. Though when a person puts the text from the elif statement, it shows the if statement print("") text. So you end up only getting one path not two, do you know how to fix that?

ash15khng (723)

This can be done by something like:

if Option1 == "yes":
    Option2 = input("option 2")
    if Option2 == "yes":
        print("answers are yes -> yes -> end")
    elif Option2 == "no":
        print("answers are yes -> no -> end")
    print("answers are no -> end")

if I understand correctly.