This commit is contained in:
RafayAhmad7548 2024-09-09 16:59:28 +05:00
parent 2992f4f408
commit 4f46de8d00
3330 changed files with 394553 additions and 76939 deletions

View file

@ -0,0 +1,34 @@
from abc import abstractmethod
import math
def calculate_total_area(shapes: list):
sum = 0
for shape in shapes:
sum += shape.area()
return sum
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)
shape = Rectangle(5, 5)
print(shape.area())

View file

@ -0,0 +1,26 @@
import math
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,29 @@
from abc import abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,34 @@
from abc import abstractmethod
import math
def calculate_total_area(shapes: list):
sum = 0
for shape in shapes:
sum += shape.area()
return sum
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)
shape = Rectangle(5, 5)
print(shape.area())

View file

@ -0,0 +1,28 @@
from abc import abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)
shape = Circle(5)
print(shape.area())

View file

@ -0,0 +1,27 @@
from abc import abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,27 @@
import math
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,3 @@
class Shape:
def area():
pass

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Python/IDS/lab3/task5.py","entries":[{"id":"e3Qc.py","timestamp":1725424572839},{"id":"jZtF.py","timestamp":1725424586899},{"id":"maFk.py","timestamp":1725424650899},{"id":"tnFd.py","timestamp":1725424710890},{"id":"xDcW.py","timestamp":1725424747440},{"id":"6IgX.py","timestamp":1725424819320},{"id":"Y9SX.py","timestamp":1725424835000},{"id":"iN8b.py","timestamp":1725424847544},{"id":"qeZx.py","timestamp":1725424859631},{"id":"oW55.py","timestamp":1725424903778},{"id":"6hzp.py","timestamp":1725424920744},{"id":"j1sx.py","timestamp":1725424930851},{"id":"QUMz.py","timestamp":1725427984588},{"id":"PiJz.py","timestamp":1725428007524},{"id":"qW1j.py","timestamp":1725428025077},{"id":"3dfJ.py","timestamp":1725428110369},{"id":"HMXg.py","timestamp":1725428264910}]}

View file

@ -0,0 +1,28 @@
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,25 @@
from abc import abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,3 @@
class Shape:
def area():
pass

View file

@ -0,0 +1,8 @@
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()

View file

@ -0,0 +1,29 @@
from abc import ABC, abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,28 @@
from abc import abstractmethod
import math
class Shape:
@abstractmethod
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)
shape = Rectangle(5, 5)
print(shape.area())

View file

@ -0,0 +1,27 @@
import math
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius
def area(self) -> float:
return math.pi * (self.radius ** 2)

View file

@ -0,0 +1,12 @@
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height

View file

@ -0,0 +1,18 @@
class Shape:
def area():
pass
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__()
self.width = width
self.height = height
def area(self) -> int:
return self.width * self.height
class Circle(Shape):
def __init__(self, radius: int) -> None:
super().__init__()
self.radius = radius