lundi 17 septembre 2018

I want to make a code using a function within an if statement in python

def temp():
    print(script)
    print(a,sce1)
    print(b,sce2)
    print(c,sce3)
    choice = str(input())

This is the code of my function

    #start
script = "You lay shackled to a wall in a room with damp walls made of rough stone, you are cold and wet, what do you do?"
sce1 = "Pull the shackles"
sce2 = "Shout for help"
sce3 = "Sit in the cold dark room for a while"
sce4 = "Start nawing your hand off"
a = "a-"
b = "b-"
c = "c-"
d = "d-"
if choice == "a":
    temp()
    #a
    script = "Your shackles break free, there is a dimmly lit room with a skeleton, a torch and a closed door"
    sce1 = "Grab the torch"
    sce2 = "Search the skeleton"
    sce3 = "Go through the door"
    a = "a-"
    b = "b-"
    c = "c-"
    temp()

and here is the code I can't seem to get working, can anyone help? I am not 100% on how functions work and how to use them within an if statement, how would I? FYI the variables are all declared properly and there is no syntax error just a logical one

Aucun commentaire:

Enregistrer un commentaire