-4
def consequence_0 ():
    consequence_0 () = input ("Now you can see into darker places...")
    try:
        if consequence_0 == 'shiny object':
            print ("You picked up a key")
        elif consequence_0 == 'pick up shiny object':
            print ("You picked up a key")
    except ValueError:
        print ("You can't carry out that action")
        print

def consequence_1 ():
    consequence_1 () = input ()
    try:
        if consequence_1 == 'open bible':
            print ("The bible opens and you see a single page attached to the inside of the cover")
        elif consequence_1 == 'open the bible':
            print ("The bible opens and you see a single page attached to the inside of the cover")
    except ValueError:
        print ("You can't carry out that action")
        print
Konstantin
  • 24,271
  • 5
  • 48
  • 65
  • 1
    Can you please post the stack trace? ... however, `consequence_0 () = input` is a function call and you are trying to assign to it. What did you want to achieve? – tdelaney May 15 '16 at 04:57
  • What exactly do you think `()` does? You might want to seek seek out a tutorial. – TigerhawkT3 May 15 '16 at 05:18
  • A naming suggestion: There's no reason to name your local variables after the function they're in, and especially no reason the name for whatever-the-user-typed should know that it's in the _n_-th function that handles user input. Name things for what they _are_... bearing in mind that `input` (frustratingly both a noun and a verb) is already claimed by a built-in. Consider something like `user_input`, `players_move`, or even just `action`. Both functions can safely use the same name for the same role, since separate functions use separate namespaces. – Kevin J. Chase May 15 '16 at 05:25
  • Possible duplicate of [Can't assign to function call (PYTHON)](http://stackoverflow.com/questions/28652444/cant-assign-to-function-call-python) – Kevin J. Chase May 15 '16 at 05:31
  • 1
    You're defining some functions, and the first thing you try to do is call them recursively, then attempt to assign to the result? That makes absolutely no sense. (1) Pick a new name for your variable (2) Assign to the variable without trying to call it like a function. E.g. change `consequence_0() = ...` to `my_var = ...` – Tom Karzes May 15 '16 at 06:07

2 Answers2

1

Change:consequence_0 () = input ("Now you can see into darker places...")
to this: consequence_0 = input ("Now you can see into darker places...")

And also this consequence_1 () = input () to consequence_1 = input ()

In this code you're trying to assign the result of input to the function, that doesn't work. You want to assign it to a variable.

Keatinge
  • 4,330
  • 6
  • 25
  • 44
0

Python shows you the line that has the error. Its likely

consequence_0 () = input ("Now you can see into darker places...")

which is a function call and you can't assign to a function call. Remove the cowboy legs and you'll have a function that prompts for darker places

def consequence_0 ():
    consequence_0 = input ("Now you can see into darker places...")
    try:
        if consequence_0 == 'shiny object':
            print ("You picked up a key")
        elif consequence_0 == 'pick up shiny object':
            print ("You picked up a key")
    except ValueError:
        print ("You can't carry out that action")
        print
tdelaney
  • 73,364
  • 6
  • 83
  • 116