Greetings! On Tue, May 15, 2018 at 2:49 PM, Sam Hoffman <animalwatching...@gmail.com> wrote: > Traceback (most recent call last): > File "/Users/samhoffman/Documents/test.py", line 54, in <module> > Battle() > File "/Users/samhoffman/Documents/test.py", line 41, in Battle > Move = input('What Will You Do? Fight or Run: ') > File "<string>", line 1, in <module> > NameError: name 'Run' is not defined
The Python interpreter believes that Run is a variable to which no value has been assigned. > > import time > import random > #Pokemon Stats > Bulbasaur = {'N' : 'Bulby', > 'HP' : 20, > 'Level' : 5, > 'Atk' : 8, > 'Def' : 9, > 'Spd' : 6} > > > Rattata = {'N' : 'Rattata', > 'HP' : 15, > 'Level' : 3, > 'Atk' : 5, > 'Def' : 6, > 'Spd' : 4} > > #Move damages > BM = {'Vinewhip' : 45, > 'Tackle' : 40, > 'Razorleaf' : 55} > > > RM = {'Tackle' : 40, > 'Quick Attack' : 40, > 'Bite' : 60} > > > #Damage is (((((2xLevel)/5)+2)xPower)xAtk/Def)+2)/50 > > > > #Battle Function > def Battle(): > print('Wild '+Rattata['N']+' Appeared!') > time.sleep(1) > print('Go, '+Bulbasaur['N']+'!') > time.sleep(1) > print(Bulbasaur['N']+ ' is out.') > while Bulbasaur['HP'] >= 1 and Rattata['HP'] >= 1: > Move = input('What Will You Do? Fight or Run: ') > if Move == Fight: > pass > elif Move == Run: # This appears to be the problem. Make Run into a > string, "Run" or 'Run'. > RC = random.randint(1,3) > if RC == 1 or 3: # This probably does not do what you think it > does! > print('You Didn\'t Get Away!') > else: > print('You Got Away!') > break > else: > print('Typo') > break > Battle() HTH! -- boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor