[Tutor] Help
Sam Hoffman
animalwatchingsam at gmail.com
Tue May 15 15:49:54 EDT 2018
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
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:
RC = random.randint(1,3)
if RC == 1 or 3:
print('You Didn\'t Get Away!')
else:
print('You Got Away!')
break
else:
print('Typo')
break
Battle()
More information about the Tutor
mailing list