Sign in to follow this  
steveworks

Python 3.0 classes?

Recommended Posts

I have recently been reading the most recent Byte of Python that is edited for python 3.0 and I have had some problems with it's example for a simple class. Here is the coding

class Person():
    def sayHI(self):
            print('Hello,how are you?')


p = Person()
p.sayHi()

I keep getting this error. Traceback (most recent call last): File "C:\Users\Eric\Desktop\Python Progs\Person Class.py", line 8, in <module> p.sayHi() AttributeError: 'Person' object has no attribute 'sayHi' can anyone tell me what I am doing wrong?

Share this post


Link to post
Share on other sites
OH MY GOD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. I can't belive I didn't catch that!>< I feel like an idiot. I checked and checked and I couldn't tell that a stinkin 'i' was screwing me over. :(. Thanks for pointing that out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this