def insert_monster_loop(): print('Here we insert a monster') name = input('Please Give Monster Name') while True: try: max_hp = int(input('What is the monsters Max HP? Minimum of 1.')) if max_hp < 1: print('That was not greater than 0') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: strength = int( input('what is this monsters strength? Minimum is 1.')) if strength < 1: print('Sorry that was not 1 or greater.') else: break except ValueError: print('Sorry, that wasn\'t a Integer.') while True: try: armor = int(input('What is the monsters Armor? Minimum of 0.')) if armor < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: xp_val = int(input('What is the monsters XP Value? Minimum of 1.')) if xp_val < 0: print( ' That was an invalid number, positive numbers only, greater than 0.' ) else: break except ValueError: print('That is not an integer.') while True: try: money = int( input('How much Money does the monster have? Minimum of 0.')) if money < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') while True: try: level = int(input('What is the monsters level? Minimum of 1.')) if level < 0: print(' That was an invalid number, positive numbers only.') else: break except ValueError: print('Sorry that was not an Integer.') # Now that all that data has been collected we toss it into the Peewee model, and send it to the DB new_monster = Monster(name, xp_val, money, level) new_monster.set_str_and_armor(strength, armor, max_hp) DM.add_monster(new_monster)