<jupyter_start><jupyter_text>Example Class<jupyter_code>import datetime # we will use this for date objects

class Person:

    def __init__(self, name, surname, birthdate, address, telephone, email):
        self.name = name
        self.surname = surname
        self.birthdate = birthdate

        self.address = address
        self.telephone = telephone
        self.email = email

    def age(self):
        today = datetime.date.today()
        age = today.year - self.birthdate.year

        if today < datetime.date(today.year, self.birthdate.month, self.birthdate.day):
            age -= 1

        return age

person = Person(
    "Jane",
    "Doe",
    datetime.date(1992, 3, 12), # year, month, day
    "No. 12 Short Street, Greenville",
    "555 456 0987",
    "<EMAIL>"
)

print(person.name)
print(person.email)
print(person.age())<jupyter_output>Jane
<EMAIL>
26<jupyter_text>__init__() method is used to initialize an instance or object of a classself.name, self.surname, self.birthdate, self.address, self.telephone, and self.email are **instance** attributes You may have noticed that both of these method definitions have ```self``` as the first parameter, and we use this variable inside the method bodies – but we don’t appear to pass this parameter in. This is because whenever we call a method on an object, the object itself is automatically passed in as the first parameter. This gives us a way to access the object’s properties from inside the object’s methods.  Class attributes We define class attributes in the body of a class, at the same indentation level as method definitions (one level up from the insides of methods):<jupyter_code>class Person:

    TITLES = ('Dr', 'Mr', 'Mrs', 'Ms')   # This is a Class attribute

    def __init__(self, title, name, surname):
        if title not in self.TITLES:
            raise ValueError("%s is not a valid title." % title)

        self.title = title
        self.name = name
        self.surname = surname
        
if __name__ == "__main__":
    me = Person(title='Mr', name='John', surname='Doe')
    print(me.title)
    print(me.name)
    print(me.surname)
    print(Person.TITLES)<jupyter_output>Mr
John
Doe
('Dr', 'Mr', 'Mrs', 'Ms')
{'fraction_non_alphanumeric': 0.1011743450767841, 'fraction_numerical': 0.00993676603432701, 'mean_word_length': 3.1871455576559544, 'pattern_counts': {'":': 1, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '3843', 'license': 'MIT', 'n_tokens_mistral': 690, 'n_tokens_neox': 645, 'n_words': 245, 'path': 'jupyter_notebooks/oop/OOP_Tutorial.ipynb', 'repo_name': 'manual123/Nacho-Jupyter-Notebooks', 'size': '2240'}