#imports #Factories #PROVIDERS #Services / APIS #Class class Contact: def __init__(self, fname, lname): self.fname = fname # attr of class = passed arg to param self.lname = lname def get_full_name(self): return "My name is " + self.fname + " " + self.lname @staticmethod def create_contact(): fname = input("Enter your first name: ") lname = input("Enter your last name: ") return Contact(fname, lname) class Product: # create an instance 3 props in that Object def __init__(self, productName, sku, price): self.productName = productName self.sku = sku self.price = price class DetailedProduct(Product): # create an instance 5 props in that Object def __init__(self, productName, sku, price, description, size): super().__init__(productName, sku, price) # 3 from parent # override and add 2 from the child self.description = description self.size = size def display_product_details(self): return f"Product Name: {self.productName} | Product SKU: {self.sku} | Product Price: {self.price} | Product Description: {self.description} | Product Size: {self.size}." #Application __main__ def main(): # Create a new contact using the static method from the Class new_contact = Contact.create_contact() # Create a new product instance 3 props in the object #show_product = Product() # Create a new detailed product instance 5 props in the object show_product_details = DetailedProduct("Widget 1", "12345", 19.99, "Description of Widget 1", "large") # Print the full name print(new_contact.get_full_name()) # Print the Product Details print(show_product_details.display_product_details()) if __name__ == "__main__": main()