Last active
May 20, 2019 16:35
-
-
Save chicagowebmanagement/f5cbd0bcaa6521e3f8c4d29fa5c6b6e6 to your computer and use it in GitHub Desktop.
Create two classes, rectange and square and display the perimeter of each
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Author: Patrick Elward | |
Date: 04/28/2019 | |
Create Rectangle and Square classes with a method called calculate_perimeter that calculates the perimeter of the shapes they represent. | |
Create Rectangle and Square objects and call the method on both of them. | |
""" | |
import math | |
class Rectangle: | |
def __init__(crash,a,b): | |
crash.a=a | |
crash.b=b | |
rectangle_perimeter = b+b+a+a | |
print("The Rectangle perimeter is " ,rectangle_perimeter) | |
class Square: | |
def __init__(crash,c): | |
crash.c=c | |
square_perimeter=c+c+c+c | |
print("The Square perimeter is ",square_perimeter) | |
Rectangle(4,6) | |
Square(7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
testing out 'crash' instead of 'self' to strengthen my OOP skills/knowledge.