Python 3- Deep Dive -part 4 - Oop- 🆕

class Employee: def __init__(self, name, salary): self.name = name self.salary = salary def calculate_pay(self): return self.salary * 0.8 # Business rule

from abc import ABC, abstractmethod class Bird(ABC): @abstractmethod def move(self): pass Python 3- Deep Dive -Part 4 - OOP-

from abc import ABC, abstractmethod class DiscountStrategy(ABC): @abstractmethod def apply(self, amount: float) -> float: pass class Employee: def __init__(self, name, salary): self

from typing import Protocol class Printer(Protocol): def print(self, doc: str) -> None: ... class Employee: def __init__(self

def save_to_db(self): print(f"Saving self.name to DB") # Persistence

class DiscountCalculator: def calculate(self, customer_type, amount): if customer_type == "standard": return amount * 0.9 elif customer_type == "vip": return amount * 0.8 elif customer_type == "employee": # Modification needed here return amount * 0.5