<jupyter_start><jupyter_text>Object Oriented Programming Homework AssignmentProblem 1Fill in the Line class methods to accept coordinate as a pair of tuples and return the slope and distance of the line.<jupyter_code>class Line(object):
    
    def __init__(self,coor1,coor2):
        
        self.coor1 = coor1
        self.coor2 = coor2
    
    def distance(self):
        
        #((x2-x1)^2 + (y2-y1)^2)^.5
        
        # Could have used tuple unpacking for ex:
        # x1, y1 = self.coor1
        # x2, y2 = self.coor2
        # return ((x2 - x1)**2 + (y2 - y1)**2)**.5
        
        return (((self.coor2[0] - self.coor1[0])**2) + 
                ((self.coor2[1] - self.coor1[1])**2))**.5
    
    def slope(self):
        
        #y2 - y1 / x2 -x1
        
        return (self.coor2[1] - self.coor1[1]) / (self.coor2[0] - self.coor1[0])
# EXAMPLE OUTPUT

c1 = (5,6) #x1, y1
c2 = (9,12) #x2, y2

li = Line(c1, c2)
li.distance()
li.slope()<jupyter_output><empty_output><jupyter_text>________Problem 2 Fill in the class<jupyter_code>class Cylinder(object):
    
    #Class Object Attribute
    
    pi = 3.14159265359
    
    def __init__(self,h=1,r=1):
        
        self.h = h
        self.r = r
        
    def volume(self):
        
        #V=π(r^2)h
        
        return Cylinder.pi*(self.r**2)*self.h
    
    def surface_area(self):
        
        #A=2πrh+2π(r^2)
        
        return 2*Cylinder.pi*self.r*self.h + 2*Cylinder.pi*(self.r**2)
# EXAMPLE OUTPUT
c = Cylinder(6,10)
c.volume()
c.surface_area()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14294790343074967, 'fraction_numerical': 0.056543837357052096, 'mean_word_length': 2.04642166344294, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '221035', 'license': 'MIT', 'n_tokens_mistral': 649, 'n_tokens_neox': 626, 'n_words': 122, 'path': 'Introduction to Python/Object Oriented Programming Homework - Assignment.ipynb', 'repo_name': 'Xelepam/Python_Scripts', 'size': '1574'}