AttributeError: 'str' object has no attribute 'attack' "'Help!" <p>I have q quick question regarding an Attribute Error regarding a basic Arena battler I am writing for my Intro to Programming Class. Here is the chunk of code that I am having trouble with upon running the program,</p> <pre><code>class Enemy: def __init__(self,player,weapons,armor): self.name = "Bad Guy" self.health = 100 self.attackPower = (player.attack + randint(-5,5)) self.defensePower = (player.defense + randint(-5,5)) self.weapon = player.weapon self.armor = player.armor def name_generator(self): import random element = ["Thunder","Lightning","Wind","Fire", "Stone"] tool = ["Hammer","Drill","Cutter","Knife", "Saw"] randomNumber1 = random.randrange(0,len(element)) randomNumber2 = random.randrange(0,len(tool)) self.randomname = element[randomNumber1] + " " + tool[randomNumber2] return self.randomname </code></pre> <p>Lol, ignore the Name Generator for now, thats an idea Ill try to work out later. The Current problem I am having now is that when I run the program through IDLE i get the following error;</p> <pre><code> File "C:\Users\Caleb Walter\Downloads\Arena_Battler.py", line 150, in __init__ self.attackPower = int(player.attack + randint(-5,5)) AttributeError: 'str' object has no attribute 'attack' </code></pre> <p>Any Help would be appreciated on the program error, as I have done research and tried to find the answer but all of the other casses of 'str' error involved lists. Thank You in Advance!</p>