Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Var Not defined
#1
So I'm pretty new to Python, although I got alot of experience in other languages.
I have a problem where my Attack variable is not being defined

Error:
if Attack == "1":
There's my code:

class Battle1:
def StartBattle():



print("")
print("YOU: How Dare You Insult My Country! You Shall Die!")
print("...................................................")
print("...................................................")
print("HP: " + str(HP) + " ENEMY HP: " + str(EHP))
print("...................................................")
print("...................................................")
print("Slash (20-30 DMG) [1]")
print("FireSpell (15-40 DMG) [2]")
print("Swift Arrow (10-60 DMG) [3]")
Attack = input("What Attack Do You Use? [1,2,3]")
if Attack == "1":
print("CHECK")
AttackDmg = randint(20,30)
EHP = EHP - AttackDmg
print("BATTLE: You Slashed Him With Your Mighty Sword, You Dealt: " + str(AttackDmg)+ " Damage!")
print("BATTLE: Your Enemy Has: " + str(EHP) + "Health")
print("")
print("GATEKEEPER: You Will Not Live Any Longer.")
EDMG = randint(10,25)
HP = HP - EDMG
print("BATTLE: GateKeeper Dealt: " + str(EDMG))
StartBattle()
Reply


Messages In This Thread
Var Not defined - by RainbowWolfy - Sep-14-2017, 08:07 PM
RE: Var Not defined - by ichabod801 - Sep-14-2017, 08:16 PM
RE: Var Not defined - by OmarBrikaa - Sep-14-2017, 08:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python library not defined in user defined function johnEmScott 2 3,938 May-30-2020, 04:14 AM
Last Post: DT2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020