I'm trying to make a battle function but am having some trouble. Is there a way to do this? At the moment I'm getting an error "AttributeError: 'function'object has no attribute 'att'. My guess is that this would be easier with classes, but I've not learned classes yet. So is this possible?
import random def player(): hp = 100 att = random.randint(10, 30) def rat(): hp = 20 att = random.randint(5, 25) def attack(player, enemy): attack = player.att - enemy.hp print(enemy.hp)