<jupyter_start><jupyter_text>Creating a class<jupyter_code>class Car:
  pass<jupyter_output><empty_output><jupyter_text>Create an Object<jupyter_code>class Car:
  def __init__(self, name, color):     # all classes have function called __init__
    self.name = name                           #attribute names of class named Car
    self.color = color 

  def decription(self):
     return "The" +  self.name + "has a color" + self.color
  
  def show(self):
    print("The" + " " + self.name +" " + "has a color" +" " + self.color)

car1 = Car("Honda City","red")
car1.show()<jupyter_output>The Honda City has a color red<jupyter_text>Object Methods<jupyter_code>class Person:
  def __init__ (self, name, age):
    self.name = name
    self.age = age
  def myFunction(self):
    print("Hello! My name is", self. name)
    print("I am", self. age, "years old")

p1 = Person("<NAME>",19)
p1.myFunction()<jupyter_output>Hello! My name is <NAME>
I am 19 years old<jupyter_text>Modify an Object Property<jupyter_code>car1.name = "Mitsubishi"
print(car1.name)

car1.color = "Blue"
print(car1.color)
car1.show()<jupyter_output>The Mitsubishi has a color Blue<jupyter_text>Delete an Object Property<jupyter_code>del car1.color
print(car1.color)
print(car1.name)
print(car1.color)<jupyter_output>Mitsubishi<jupyter_text>Application 1 - Write a Python program that computes for the Area and Perimeter of a Square, and create a class name Square with side as its attribute.<jupyter_code>#Area of a Square = s*a
#Perimeter of a Square = 4*s = s+s+s+s

class Square:
  def __init__ (self,side):
    self.side = side
  
  def Area(self):
    return self.side*self.side

  def Perimeter(self):
    return 4*(self.side)

  def display(self):
    print("The area of a square is", self.Area())
    print("The perimeter of a square is", self.Perimeter())

sq1 = Square(2)
sq1.display()<jupyter_output>The area of a square is 4
The perimeter of a square is 8<jupyter_text>Application 2 : Write a Python program that display your student no. and full name (Surname, First Name MI) and create a class name OOP_58002<jupyter_code>class Person:
  def __init__ (self, name,studentnumber,classname):
    self.name = name
    self.studentnumber= studentnumber
    self.classname=classname
  def myFunction(self):
    print("My Name is", self. name)
    print("My Student Number is", self. studentnumber)
    print("And I belong to the class of", self. classname)

p1 = Person("Tabligan, <NAME>.",202150371,"OOP_58002")
p1.myFunction()<jupyter_output>My name is Tabligan, <NAME>.
My Student Number is 202150371
And I belong to the class of OOP_58002
StarcoderdataJupyterStructuredCleanDedup