# Contact.py class ExampleClass: # not using attributes # uses variables fname = 'Bob' lname = 'Smith' fullname = f"{fname} {lname}" # template variables # fullname = fname + ' ' + lname ## join # fullname = fname, lname ## parameterization print(fullname) # Classes page 53-55 # Isolation of code for access control and reusability # creating Classes using attributes of the class rather than variables in the class class Contact: # self -> 3 attrs # define attributes INSTEAD of variables # built-in core method for defining attributes __init__() # function and method are the same, but they return to something else ## functions return value to itself ## methods return value to something else def __init__(self, fname, lname, age): # Python Core # prop = paramater passed to __init__() self.fname = fname self.lname = lname self.age = age # __str__() method page 56 Python Core def __str__(self): return f"Contact Information >>> Name: {self.fname} {self.lname} Age: {self.age}." # My Program print("Welcome to my program") print("---------------------") ## Create an INSTANCE of the class object in the program contact1 = Contact('Bob', 'Smith', 21) # contact1 is the name of the INSTANCE of the class object in memory print(contact1)