Title: How do I fix this branching / story making on python?
Tags: python;input
Question: ```sceneDict = {}

sceneDict["Beggining"] = {
"Branching" : False
"SceneText" : "Walking towards the enterance to the hollowed out tree you \
notice some large skulls on the sides of the dirt path along with other \
large sized bones which don't look like anything you've ever seen before.",
"NextScene" : "Enterance"
}

sceneDict["Enterance" = {
"Branching": True,
"SceneText" : "You come up to the cave enterance and upon inspecting it you notice some \
liquid dripping from the roof of the enterance, you catch a small amount in your hand.. It's \
red and has the consistency of blood. All of a sudden a thundering roar is heard behind you and a massive \
troll has appeared!",
"Choices" : [
        {"ChoiceNumber" : "1. ",
         "ChoiceText" : "Run into the cave to escape the troll",
         "NextScene" : "Cave"},
        {"ChoiceNumber" : "2. ",
         "ChoiceText" : "Attempt to escape between the trolls legs",
         "NextScene" : "Chase"},
        {"ChoiceNumber" : "3. ",
         "ChoiceText" : "Pull out your sword in an attempt to combat the troll"
         "NextScene" : "Combat"}
    ]
}

sceneDict["Combat"] = {
"Branching": False,
"SceneText" : "As you reach back to grab your sword from your back the troll puts its arm out to the \
side and in one sweeping motion smashes you into a tree, unfortunately ending your life.",
"NextScene" : "Afterlife"
}

sceneDict["Afterlife"] = {
"Branching": True,
"SceneText" : "You feel sunlight on your face and as you open your eyes there is two pathways infront of you \
as well as a sign over top of both'that's strange, I should probably be dead' however, above the arrow signs \
there is a sign that reads 'You messed up, it happens but try again' the paths both lead to the two other choices\
you had before you took the worst of the three choices.",
"Choices" : [
        {"ChoiceNumber" : "1. ",
         "ChoiceText" : "Run into the cave to escape the troll",
         "NextScene" : "Cave"},
        {"ChoiceNumber" : "2. ",
         "ChoiceText" : "Attempt to escape between the trolls legs",
         "NextScene" : "Chase"}
    ]
}

sceneDict["Chase"] = {
"Branching": False,
"SceneText" : "You slide on your knees between the trolls legs as it's enormous fists come crashing down behind \
you, you get back up and start running down the hill towards your village hearing its thunderous steps close \
behind. The people of your town hear the ruckus and go towards the gate to see you being chased and they all \
start cheering you to keep going!",
"NextScene" : "Decisions"
}

sceneDict["Decisions"] = {
"Branching": True,
"SceneText" : "You are about 100 meters out from your village but you remember that there is a river to the \
right of the gate you could most likely lead the troll over there and have it crash through the bridge \
into the water, or you could chance the guards speed of closing the gate to block the troll.",
"Choices" : [
         {"ChoiceNumber" : "1. ",
         "ChoiceText" : "Continue towards the village",
         "NextScene" : "Village"},
        {"ChoiceNumber" : "2. ",
         "ChoiceText" : "Run towards the water",
         "NextScene" : "Bridge"}
     ]
}

sceneDict["Village"] = {
"Branching": False,
"SceneText" : "You run towards the village as fast as you possibly can the troll clearling gaining on you \
you call out for the guards to start closing the gate as you are running, the gate begins to close as you \
close in on it, you quickly slide through the last remaining opening as the gate slams shut followed by a loud \
'BANG!' as the troll smashes his head into the gate. The village cheers as you made it back alive!",
}
sceneDict["Bridge"] = {
"Branching": False,
"SceneText" : "As the villagers are cheering they start questioning what are you doing?! You change your path \
and go for the bridge. You start running over the wooden bridge as it is creeking and after a few seconds \
really shaking. Suddenly you hear a snap as the bottom gives out and you grab onto the side of the bridge. \
The bridge falls away at your feet only leaving the sides to hold onto as you hear a loud splash and see \
the troll floating away into the distance.",
}

sceneDict["Cave"] = {
"Branching": True,
"SceneText" : "You run forward into the cave, and slip on some of the blood into the depths of it. Behind you \
the troll is coming, however you hear the sound of splashing further into the cave.",
"Choices" : [
        {"ChoiceNumber" : "1. ",
         "ChoiceText" : "Run deeper into the cave towards the splashing",
         "NextScene" : "Jump"},
        {"ChoiceNumber" : "2. ",
         "ChoiceText" : "Stand your ground to the troll",
         "NextScene" : "Learn"}
    ]
}
sceneDict["Jump"] = {
"Branching": False,
"SceneText" : "You run towards the end of a cliff which has a small waterfall going over the edge of it \
you hear the troll gaining on you, but the drop is managable, you take a step back and leap for glory! You \
land with a splash and the troll sits at the top roaring in anger at your escape, you made it.. now to find \
your way home..",
}

sceneDict["Learn"] = {
"Branching": False,
"SceneText" : "You reach back to grab your sword from your back but in one swift movement the troll smashes you \
into the ground turning you into mince meat, very unfortunate.. You hear a shimmering sound and you appear back \
in on the path towards the cave again as if a God has given you a second chance or something.",
"NextScene" : "Enterance"
}

currentScene = "Beggining"

while currentScene != "":
    sceneData = sceneDict[currentScene]
    print(sceneData["SceneText"])
    print()

    if sceneData["Branching']:
        for choice in sceneData["Choices"]:
            print(choice["ChoiceNumber"] + choice["ChoiceText"])

        print()

        answer = input("&gt; ")
        print()

        answer = int(answer) - 1
        if answer <= len(sceneData["Choices"])
            currentScene = sceneData["Choices"][answer]["NextScene"]

    else:
        currentScene = sceneData ["NextScene"]

window.exitonclick()
```

I have this code, and it should work it looks flawless, however I am getting a syntax error every time I run it but it does not point me to the error? Where is the error and how do I fix it if you could help that'd be great thanks!



Here is another answer: In your while loop, you have used the incorrect closing quote in your if statement:

```if sceneData["Branching']
```

You should use either:

```if sceneData["Branching"]
```

or:

```if sceneData['Branching']
```

Also, in order to have text on multiple lines you should do the following:

```sceneDict["Beggining"] = {
    "Branching" : False
    "SceneText" : "Walking towards the enterance to the hollowed out tree you \n"
                  "notice some large skulls on the sides of the dirt path along with other \n"
                  "large sized bones which don't look like anything you've ever seen before.",
    "NextScene" : "Enterance"
}
```

Comment for this answer: Hey, thanks for responding I fixed that and also noticed earlier I had

`sceneDict["Enterance" = {`

so I fixed that to 

`sceneDict["Enterance"] = {`

but after fixing those two things I still receive a syntax error and it doesn't point to it.
Comment for this answer: So I indented everything that you showed above, and did the adjustments to the splitting of lines.. but I still get syntax errors without them being pointed to by Python, so I really have no idea as to where the code is faulted.
Comment for this answer: Added the commas in the right places for the choices and dictionaries, aswell as the colon after choices but now I am getting a syntax error near the top in the first set on choices on the 3rd one { bracet
Comment for this answer: Make sure that your key value pairs in your dictionaries are all separated by commas and the last thing I can see is you are missing a colon after the following if statement:
if answer <= len(sceneData["Choices"])

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:11/19/15', 'FavoriteCount': 0.0, 'PostTypeId': 1, 'Tags': '<python><input>', 'Title': 'How do I fix this branching / story making on python?', 'ViewCount': 241, 'id': 33794320, 'user_AboutMe': '', 'user_AccountId': 7051259.0, 'user_DisplayName': 'Gramaru', 'user_Reputation': 7.0, 'user_Views': 8.0, 'user_id': 5400233.0}}