<jupyter_start><jupyter_text>Classes with multiple objects<jupyter_code>class Birds:
  def __init__(self,birds_name):
    self.birds_name = birds_name
  def flying_birds(self):
    print(f"{self.birds_name}flies above the sky")
  def non_flying_birds(self):
    print(f"{self.birds_name} is the national bird of Australia")

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

vulture.flying_birds()
crane.flying_birds()
emu.non_flying_birds()<jupyter_output>Griffor Vultureflies above the sky
Common Craneflies above the sky
Emu is the national bird of Australia<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
  
object_foo = foo(3,4)
object_foo.add()

object_foo.a = 6
object_foo.add()<jupyter_output><empty_output><jupyter_text>Encapsulation (mangling with double underscore)<jupyter_code>class foo:
  def __init__(self,a,b):
    self.__a = a
    self.__b = b

  def add(self):
    return self.__a + self.__b
  
object_foo = foo(3,4)
object_foo.add()

object_foo.__a = 6
object_foo.add()
class Counter:
  def __init__(self):
    self.current = 0

  def increment(self):
    self.current +=1

  def value(self):
    return self.current

  def reset(self):
    self.current = 0

counter = Counter()

counter.increment()
counter.increment()
counter.increment()

print(counter.value())
class Counter:
  def __init__(self):
    self.current = 0
  def increment(self):
    self.current +=1
  def value(self):
    return self.current
  def reset(self):
    self.current= 0

number = Counter()
number.increment()
number.increment()
number.increment()

print(number.value())
class Counter:
  def __init__(self):
    self.__current = 0
  def increment(self):
    self.__current +=1
  def value(self):
    return self.__current
  def reset(self):
    self.__current= 0

number = Counter()
number.current = 1

number.increment()
number.increment()
number.increment()


print(number.value())<jupyter_output>3<jupyter_text>Inheritance<jupyter_code>class Person:
  def __init__(self,firstname,surname):
    self.firstname = firstname
    self.surname = surname

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

person =Person("Michael","Colcol")
person.fullname()

class Student(Person):
  pass

person2 = Student("Mikey","Colcol")
person2.fullname()

class Student(Person):
  pass

person3 = Student("Abish","Famindalan")
person3.fullname()<jupyter_output><NAME>
<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

obj1 = Square(4)
print(obj1.area())

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

  def fullname(self):
    print(self.__firstname,self.__lastname)

  def Grade(self):
    return(self.__a + self.__b + self.__c)


std1 = Student("Michael","Colcol") 
std1.fullname()

class Student(Person):
  pass

a = int(input("Prelims:"))
b = int(input("Midterm:"))
c = int(input("Finals:"))

class Average:
  def __init__(self,prelim,midterm,final):
    self.prelim = prelim
    self.midterm = midterm
    self.final = final

input_average = (a + b + c)/3
print("Average",input_average)
 
std2 =Student("Abish","Famindalan") 
std2.fullname()

class Student(Person):
  pass

a = int(input("Prelims:"))
b = int(input("Midterm:"))
c = int(input("Finals:"))


class Average:
  def __init__(self,prelim,midterm,final):
    self.prelim = prelim
    self.midterm = midterm
    self.final = final

input_average = (a + b + c)/3
print("Average",input_average)

std3 =Student("Jennie","Kim") 
std3.fullname()

class Student(Person):
  pass

a = int(input("Prelims:"))
b = int(input("Midterm:"))
c = int(input("Finals:"))

class Average:
  def __init__(self,prelim,midterm,final):
    self.prelim = prelim
    self.midterm = midterm
    self.final = final

input_average = (a + b + c)/3
print("Average",input_average)<jupyter_output><NAME>
Prelims:99
Midterm:99
Finals:99
Average 99.0
<NAME>indalan
Prelims:99
Midterm:99
Finals:100
Average 99.33333333333333
<NAME>
Prelims:95
Midterm:98
Finals:99
Average 97.33333333333333
{'fraction_non_alphanumeric': 0.12750983233285035, 'fraction_numerical': 0.022148623473400953, 'mean_word_length': 4.7729988052568695, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '47248', 'license': 'Apache-2.0', 'n_tokens_mistral': 1829, 'n_tokens_neox': 1696, 'n_words': 382, 'path': 'OOP_Concepts_2_.ipynb', 'repo_name': 'MichaelColcol/OOP-1-1', 'size': '4870'}