I have a code that I've been messing around with and the monster attack (monster.ma) isn't randomising after the first time it's called upon (elif statement). I've tried to make it a tuple since they are immutable but it doesn't randomise after the first time. I was told to make a class and that's what I have done but it still doesnt work right. My attack variable (att) works right, but monsters' attack gets stuck. I know I can code the monster's attack into the elif statement, but I want to be able to just call upon it when needed.
import random
class monster():
hp=50
ma=random.randint(5, 20)
xp=random.randint(15, 30)
a=1
exp=0
while a==1:
if monster.hp<=0:
exp+=monster.xp
print"you have killed the monster"
print("you get, "+str(monster.xp)+" exp from monster"
"you now have, "+str(exp)+" exp")
break
elif monster.hp>=0:
print"swing your sword"
att=random.randint(5, 15)
monster.hp-=att
print"you do, "+str(att)+" damage to monster"
print"monster does, "+str(monster.ma)+" damage to you" #<----------------here