Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python (retired) Inheritance Instance Methods

Error !!

I created an object called log and when I used log.hip_point it shows error. what might be the problem? (PS: I am using python 2.7)

class Character:

  hit_point=7
  xp=5

  def get_weapon(self):
    weapon=raw_input('weapon([S]word,[A]xe,[K]nife): ').lower()

    if weapon in 'sak':

      if weapon=='s':
        return 'sword'
      elif weapon=='a':
        return 'axe'
      else :
        return 'knife'

    else:
      return self.getweapon()

  def __init__(self,**kwargs):
    self.name=raw_input('Enter: ' )
    self.weapons=self.get_weapon()
    self.hp=

    for k,v in kwargs.items():
        setattr(self,k,v)
Afrid Mondal
Afrid Mondal
6,255 Points

is it hip_point or hit_point???

1 Answer

andi mitre
STAFF
andi mitre
Treehouse Guest Teacher

Hey Saro - for starters one error that you might be getting is a syntax error on line self.hp =. Can you possibly share all the other errors you are getting?

Cheers