dotfiles/.config/Code/User/History/5b46c3f1/6hzp.py

30 lines
557 B
Python
Raw Normal View History

2024-09-09 16:59:28 +05:00
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)