-4

error info:

Traceback (most recent call last):
  File "C:/Users/ADMIN/Desktop/python/footballcomplex.py", line 85, in <module>
    if input2 == 'a':
NameError: name 'input2' is not defined

this is line 83-85:

input2 = input("Would you like to long pass to 3(a) or through ball to 2(b)")

if input2 == 'a':

If you want to read the whole thing right now :

link to codehttps://pastebin.com/bhYMKa8M

The problem is for when I put b or c for the first a,b and c question.But A works perfectly fine.

Please help I literally have no idea. Python ver 3.7

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
cat
  • 1
  • 2
    The call to `input` is part of the `if`-block in the code before. The indentation is nearly invisible because you indent with only one space. For heavens sake, please respect the [Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/) and use four spaces to indent each level. – Matthias Oct 18 '19 at 17:30
  • "... but it is." No, it's not. – chepner Oct 18 '19 at 17:34

2 Answers2

2

Remove the indentation before line83

Mr_U4913
  • 1,294
  • 8
  • 12
1

Line 83,

input2 = input("Would you like to long pass to 3(a) or through ball to 2(b)")

is in the if statement before it.

if input1 == 'a':

Right now it is only asking for input when input1=='a', but if you take that indentation out it will ask for input regardless of input1

SRT HellKitty
  • 577
  • 3
  • 10
  • you have passed input2 in a if condition of input1 , remove the extra space before the statement, input2 = input("Would you like to long pass to 3(a) or through ball to 2(b)") – hardik gosai Oct 19 '19 at 09:57