0

I don't know why it does this. Here's the code.

ac1 = input('1=Jab, 2=Punch, 3=Kick, or 4=Taunt?: ')
if ac1 = 1:
    print('You jab at Apollo Creed. He dodges it.')
    print('Apollo Creed continues to taunt.')

I'm making a Text based game based on the Rocky movies. :D the 1=jab and stuff means One equals Jab (if you type 1, you jab.)

Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39
Lava
  • 9
  • 3

2 Answers2

1

Single = sign is assignment. Equality is double =:

if ac1 == 1:
Selcuk
  • 57,004
  • 12
  • 102
  • 110
1

You are using a single equals sign, this is used to set variables.

Use double equals == to check if a variable is equal to something.

ac1 = input('1=Jab, 2=Punch, 3=Kick, or 4=Taunt?: ')
if ac1 == 1:
    print('You jab at Apollo Creed. He dodges it.')
    print('Apollo Creed continues to taunt.')
99lives
  • 798
  • 1
  • 8
  • 17