# Define A Class Named Rectang Le Which Represents Rectangles [Solved]

Question 1

Question 2

Where was Ludwig Wittgenstein born? Ludwig Wittgenstein Ludwig Wittgenstein is considered to be one of the greatest philosophers of the 20th century. His work and ideas included subjects like linguistics, mathematics, logic, and the philosophy of the mind. His m
Question 3

How did Ludwig Wittgenstein die? Ludwig Wittgenstein Ludwig Josef Johann Wittgenstein held many positions during his lifetime such as elementary school teacher, university professor, soldier during World War I, author, and hospital porter during World War II. Born in Austria in 1889, his reputation has grown exponentially where today he is regarded as one of the most important philosophers of the 20th century.
Question 4

What does John Rawls mean by saying “justice as fairness”? John Rawls: John Rawls (John Bordley Rawls) was an important and influential American philosopher during the twentieth century. He was born on February 21, 1921 and died on November 24, 2002. He is best known for his philosophical work A Theory of Justice (1971).

class Rectangle():

def __init__(self, width=1, height=1):
self.height = height
self.width = width

def __str__(self):
return f’Rectangle:{self.width}x{self.height}’

def get_area(self):
return self.height*self.width

def get_perimeter(self):
return 2*(self.height+self.width)

r1 = Rectangle(3,4)
print(r1.width,r1.height)
print(r1)

r2 = Rectangle()
print(r2.width,r2.height)
print(r2)

print(r1.get_area())
print(r1.get_perimeter())
print(r2.get_area())
print(r2.get_perimeter())

Code screenshot:

output attached:

TASK3 : to create class RectangleBound

class Rectangle:

def __init__(self, width=1, height=1):
self.height = height
self.width = width

def __str__(self):
return f’Rectangle:{self.width}x{self.height}’

def get_area(self):
return self.height*self.width

def get_perimeter(self):
return 2*(self.height+self.width)

class RectangleBound:
def __init__(self, width=100, height=100):
self.height = height
self.width = width
self.rectangles=[]

bound1 = RectangleBound()
print(bound1.width,bound1.height,bound1.rectangles)
bound2 = RectangleBound(10,20)
print(bound2.width,bound2.height)
bound3 = RectangleBound(20,10)
print(bound3.width,bound3.height)

class Rectangle:

def __init__(self, width=1, height=1):
self.height = height
self.width = width

def __str__(self):
return f’Rectangle:{self.width}x{self.height}’

def get_area(self):
return self.height*self.width

def get_perimeter(self):
return 2*(self.height+self.width)

class RectangleBound:
def __init__(self, width=100, height=100):
self.height = height
self.width = width
self.rectangles=[]

if(rectangle.width<self.width and rectangle.height<self.height):
self.rectangles.append(rectangle)

def __str__(self):
if(len(self.rectangles)>0):
str =  “Rectangles:\n” ;
for x in self.rectangles:
str+= f’Rectangle:{x.width}x{x.height}\n’
return str
else:
return “No rectangles.”

bound1 = RectangleBound(200,200)
print(bound1)

print(bound1)

Code screenshot :

Code :

class Rectangle:

def __init__(self, width=1, height=1):
self.height = height
self.width = width

def __str__(self):
return f’Rectangle:{self.width}x{self.height}’

def get_area(self):
return self.height*self.width

def get_perimeter(self):
return 2*(self.height+self.width)

class RectangleBound:
def __init__(self, width=100, height=100):
self.height = height
self.width = width
self.rectangles=[]

if(rectangle.width<self.width and rectangle.height<self.height):
self.rectangles.append(rectangle)

def __str__(self):
if(len(self.rectangles)>0):
str =  “Rectangles:\n” ;
for x in self.rectangles:
str+= f’Rectangle:{x.width}x{x.height}\n’
return str
else:
return “No rectangles.”

def get_number_of_rectangles(self):
return len(self.rectangles)

def get_total_area(self):
total =0
for x in self.rectangles:
total += x.get_area()

bound1 = RectangleBound(200,200)
print(bound1)

print(bound1.get_number_of_rectangles())
print(bound1.get_total_area())

Code screenshot :