from rectangle import Rectangle, Square, Circle rect_1 = Rectangle(3, 4) rect_2 = Rectangle(12, 5) #вывод площади наших двух прямоугольников print(rect_1.get_area()) print(rect_2.get_area()) square_1 = Square(5) square_2 = Square(10) print(square_1.get_area_square(), square_2.get_area_square()) figures = [rect_1, rect_2, square_1, square_2] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) else: print(figure.get_area()) circle_1 = Circle(4) print(circle_1.get_area_circle())
from rectangle import Rectangle, Square, Circle r1 = Rectangle(10, 5) r2 = Rectangle(15, 5) print(r1.get_area()) print(r2.get_area()) s1 = Square(5) s2 = Square(3) print(s1.get_area_square(), s2.get_area_square()) c1 = Circle(6) c2 = Circle(10) print(c1.get_area_circle(), c2.get_area_circle()) figures = [r1, r2, s1, s2, c1, c2] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) elif isinstance(figure, Circle): print(figure.get_area_circle()) else: print(figure.get_area())
from rectangle import Rectangle, Square, Circle #далее создаем два прямоугольника rect_1 = Rectangle(3, 4) rect_2 = Rectangle(12, 5) #вывод площади двух прямоугольников print(rect_1.get_area()) print(rect_2.get_area()) square_1 = Square(5) square_2 = Square(10) print(square_1.get_area_square(), square_2.get_area_square()) circle_1 = Circle(10) print("площадь круга", circle_1.get_area_circle()) figures = [rect_1, rect_2, square_1, square_2] print(square_1.get_area_square(), square_2.get_area_square()) for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) else: print(figure.get_area())
from rectangle import Rectangle, Square, Circle rect_1 = Rectangle(3, 4) rect_2 = Rectangle(12, 5) print(rect_1.get_area()) print(rect_2.get_area()) square_1 = Square(5) square_2 = Square(10) print(square_1.get_area_square(), square_2.get_area_square()) circle_1 = Circle(10) circle_2 = Circle(20) print(circle_1.get_area_circle(), circle_2.get_area_circle()) figures = [rect_1, rect_2, square_1, square_2, circle_1, circle_2] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) elif isinstance(figure, Rectangle): print(figure.get_area()) else: print(figure.get_area_circle())
from rectangle import Rectangle, Square, Circle rect1 = Rectangle(4, 5) rect2 = Rectangle(3, 5) print(rect1.get_area()) print(rect2.get_area()) square1 = Square(5) square2 = Square(9) print(square1.get_area_square(), square2.get_area_square()) circle = Circle(6) print(circle.get_area_circle()) figures = [rect1, rect2, square1, square2, circle] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) elif isinstance(figure, Circle): print(figure.get_area_circle()) else: print(figure.get_area())
from rectangle import Rectangle, Square, Circle rect_1 = Rectangle(3,4) rect_2 = Rectangle(12,5) print("Площадь первого прямоугольника = ", rect_1.get_area()) print("Площадь второго прямоугольника = ",rect_2.get_area()) square_1 = Square(5) square_2 = Square(10) print("Площадь первого квадрата = ", square_1.get_area_square(), "Площадь второго квадрата = ", square_2.get_area_square()) radius_1 = Circle(8) radius_2 = Circle(15) print("Площадь первого круга = ", radius_1.get_area_circle(), "Площадь второго круга = ", radius_2.get_area_circle()) figures = [rect_1, rect_2, square_1, square_2, radius_1, radius_2] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) elif isinstance(figure, Circle): print(figure.get_area_circle()) else: print(figure.get_area())
from rectangle import Rectangle, Square, Circle # далее создаем два прямоугольника и два круга rect_1 = Rectangle(3, 4) rect_2 = Rectangle(12, 5) circ_1 = Circle(3.14, 4) circ_2 = Circle(3.14, 7) # вывод площадей наших фигур print(rect_1.get_area()) print(rect_2.get_area()) print(circ_1.get_area_circle()) print(circ_2.get_area_circle()) square_1 = Square(5) square_2 = Square(10) circle_3 = Circle(3.14, 4) circle_4 = Circle(3.14, 6) print(square_1.get_area_square(), square_2.get_area_square(), circle_3.get_area_circle(), circle_4.get_area_circle()) figures = [rect_1, rect_2, square_1, square_2, circle_3, circle_4] for figure in figures: if isinstance(figure, Circle): print(figure.get_area_circle()) if isinstance(figure, Square): print(figure.get_area_square())
from rectangle import Rectangle, Square, Circle rect_1 = Rectangle(3, 4) rect_2 = Rectangle(12, 5) print(rect_1.get_area()) print(rect_2.get_area()) square_1 = Square(5) square_2 = Square(10) print(square_1.get_area_square(), square_2.get_area_square()) figures = [rect_1, rect_2, square_1, square_2] for figure in figures: if isinstance(figure, Square): print(figure.get_area_square()) else: print(figure.get_area()) circle_1 = Circle(1000) circle_2 = Circle(5000) print(circle_1.get_area_circle()) # находим площадь круга print(circle_2.get_area_circle())