My Name Is Hellokitty
My Name Is Hellokitty
Python Class:
• A class is a user-defined blueprint from which objects are created
Class Car
Constructor
Using the above class, we can create multiple objects that depict different states and behavior
• Brown
• Curious
• Noisy
• Pink
• Timid
Class Constructor • Noisy
• Blue
• Curious
• Quiet
_ _ init _ _ ( ) Function:
Self Parameter:
• Class methods must have an extra first parameter in the method definition
• Python provides the value for this parameter when we call the method
Example:
Exercise:
The exercises done today will be stored in the Lesson 12 folder.
Exercise 1:
Create a new Python file and name it “Car Class.py”.
Exercise 2:
Create a new Python file and name it “Dog Class.py”.
Exercise 3:
Create a new Python file and name it “Turtle Class.py”.
Homework:
Create a new Python file and name it “Homework12.py”.
Write a Python program using a class method to get the expected result as shown below:
Template
Class: Student
Attributes: Gender, Age, Height