import random

class monster:

def __init__(self,monstername,mod):

self.monstername = monstername

self.initativeModifier = mod

def __str__(self):

roll = random.randint(1,20)

total = self.initativeModifier + roll

return "%s rolled %s for a total of %s" % (self.monstername, roll, total)

MESSAGE_HOW_MANY_MONSTERS = "How many monsters are there? "

MESSAGE_HOW_MANY_PLAYERS = "How many characters are there? "

MESSAGE_PLAYERS_NAME = "What is the players name? "

MESSAGE_MONSTER_NAME = "What is the creatures name? "

MESSAGE_MODIFIER = "What is %s\'s modifier? "

def get_creatures(message,message2):

mobs = []

countofmonsters = input(message)

for i in range(countofmonsters):

monstername = raw_input(message2)

monstermod = input(MESSAGE_MODIFIER %monstername)

mobs.append(monster(monstername,monstermod))

return mobs

players = get_creatures(MESSAGE_HOW_MANY_PLAYERS,MESSAGE_PLAYERS_NAME)

while(True):

monsters = get_creatures(MESSAGE_HOW_MANY_MONSTERS,MESSAGE_MONSTER_NAME)

for mob in players:

print mob

for mob in monsters: