<jupyter_start><jupyter_text>Classes with Multiple Objects<jupyter_code>class Birds:
  def __init__(self, bird_name):
    self.bird_name = bird_name

  def flying_birds(self):
    print(f"{self.bird_name} flies above clouds")
    
  def non_flying_birds(self):
    print(f"{self.bird_name} is the national bird of the Philippines")

vulture = Birds("Griffon Vulture")
crane = Birds("Common Crane")
emu = Birds("Emu")

vulture.flying_birds()
crane.flying_birds()
emu.non_flying_birds()<jupyter_output>Griffon Vulture flies above clouds
Common Crane flies above clouds
Emu is the national bird of the Philippines<jupyter_text>Encapsulation<jupyter_code>class foo:
  def __init__(self, a, b):
    self._a = a
    self._b = b

  def add(self):
    return self._a + self._b
  def sub(self):
    return self._a - self._b
foo_object = foo(3,4)

#foo_object = foo(3,4)
#print(foo_object.add())
#print(foo_object.sub())

foo_object.b = 5 #(3,5)
#print(foo_object.b)
print(foo_object.add()) #adding a and b
print(foo_object.sub()) #subtracting a and b

foo_object.__b = 5
foo_object.__a = 7

print(foo_object.add())
print(foo_object.sub())
#print(foo_object._a)
#print(foo_object._b)<jupyter_output>7
-1
7
-1<jupyter_text>Inheritance<jupyter_code>class Person:
  def __init__(self,firstname,surname):
    self.firstname = firstname
    self.surname = surname

  def printname(self):
    print(self.firstname,self.surname)

person = Person("Chelsea", "Magleo")
person.printname()

class Student(Person):
  pass

person = Student("Reigne", "Magleo")
person.printname()<jupyter_output><NAME>
<NAME><jupyter_text>Polymorphism<jupyter_code>class RegularPolygon:
  def __init__(self,side):
    self.side = side

class Square(RegularPolygon):
  def area(self):
    return self.side * self.side
class EquilateralTriangle(RegularPolygon):
  def area(self):
    return self.side * self.side * 0.433

x = Square(4)
y = EquilateralTriangle(3)

print(x.area())
print(y.area())<jupyter_output>16
3.897<jupyter_text>Application 1 1. Create a Python program that displays the name of three students(Student 1, Student 2, Student 3) and their term grades2. Create a class name Person and attributes - std1, std2, pre, mid, fin3. Compute the average of each term grade using Grade() method4. Information about student's grade must be hidden from others<jupyter_code>class Person:
  def __init__(self, std1, std2, pre, mid, fin):
    self.std1 = std1
    self.std2 = std2
    self.pre = pre
    self.mid = mid
    self.fin = fin

  def student1(self):
    print(f"{self.std1} is {self.std2}")
  def pre_ave(self):
    return (self.pre*.3)+(self.pre*.7)
  def mid_ave(self):
    return (self.mid*.3)+(self.mid*.7)
  def fin_ave(self):
    return (self.fin*4)+(self.fin*.6)
  def display(self):
    print("Average for prelim: ", self.pre_ave())
    print("Average for midterm: ", self.mid_ave())
    print("Average for finals: ", self.fin_ave())
    


class Grade(Person):
  pass
  wei = Person ("The First student","<NAME>", 89, 98, 90)
  wei.student1()
  wei.display()

class Grade_std2(Person):
  pass
  mei = Person("The second student", "Mei", 86, 90, 96)
  mei.student1()
  mei.display()<jupyter_output>The First student is <NAME>
Average for prelim:  89.0
Average for midterm:  98.0
Average for finals:  414.0
The second student is Mei
Average for prelim:  86.0
Average for midterm:  90.0
Average for finals:  441.6
{'fraction_non_alphanumeric': 0.12912735849056603, 'fraction_numerical': 0.025058962264150945, 'mean_word_length': 4.535073409461664, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '614364', 'license': 'Apache-2.0', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1224, 'n_words': 314, 'path': 'OOP_2.ipynb', 'repo_name': 'Chelsea-Magleo/OOP-58002', 'size': '3409'}