class main(): circle = Circle(4) rectangle = Rectangle(1, 3) displayObject(circle) displayObject(rectangle) print("원과 사각형의 크기가 같습니까?", isSameArea(circle, rectangle))
def main(): # Display circle and rectangle properties c = Circle(4) r = Rectangle(1, 3) displayObject(c) displayObject(r) print("Are the circle and rectangle the same size?", isSameArea(c, r))
def main(): # 원과 사각형의 속성을 출력한다. c = Circle(4) r = Rectangle(1, 3) displayObject(c) displayObject(r) print("원과 사각형의 크기가 같습니까?", isSameArea(c, r))
def main(): # Display circle and rectangle properties c = Circle(4) r = Rectangle(1, 3) e = Ellipse(5, 5) s = Square(5, 5) all_shapes = [c, r, e, s] print(all_shapes) displayObject(c) displayObject(r) displayObject(e) displayObject(s) print("Are the circle and rectangle the same size?", isSameArea(c, r)) isSameArea(c, e) isSameArea(c, s) isSameArea(r, c) isSameArea(r, e) isSameArea(r, s) isSameArea(e, c) isSameArea(e, r) isSameArea(e, s) isSameArea(s, c) isSameArea(s, r) isSameArea(s, e) new_list = sorted(all_shapes, key=area_of_shape) print(new_list)
def main(): # Display circle and rectangle properties c = Circle(4) r = Rectangle(1, 3) print("Circle...") displayObject(c) print("Rectangle...") displayObject(r)
def main(): myC1 = Circle(2) myR1 = Rectangle(2,3) print(myC1.getArea()) print(myR1.getColor()) myC1.setColor("green") print(myC1.getColor()) print(myR1.getColor())
def main(): # 원과 사각형의 속성을 출력한다 c = Circle(4) r = Rectangle(1, 3) print("원...") displayObject(c) print("사각형...") displayObject(r)
class main(): circle = Circle(1.5) print("원", circle) print("넓이는", circle.getArea(), "입니다") print("지름은", circle.getPerimeter(), "입니다") rectangle = Rectangle(2, 4) print("\n사각형", rectangle) print("넓이는", rectangle.getArea(), "입니다") print("둘레는", rectangle.getPerimeter(), "입니다")
def main(): circle = Circle(1.5) print("A circle", circle) print("The radius is", circle.getRadius()) print("The diameter is", circle.getDiameter()) rectangle = Rectangle(2, 4) print("\nA rectangle", rectangle) print("The area is", rectangle.getArea()) print("The perimeter is", rectangle.getPerimeter())
def main(): circle = Circle(1.5) print("원", circle) print("반지름은", circle.getRadius(), "입니다.") print("넓이는", circle.getArea(), "입니다.") print("지름은", circle.getDiameter(), "입니다.") rectangle = Rectangle(2, 4) print("\n사각형", rectangle) print("넓이는", rectangle.getArea(), "입니다.") print("둘레", rectangle.getPerimeter(), "입니다.")
class main(): circle = Circle(4) rectangle = Rectangle(1, 3) triangle = Triangle(4, 5, 8) print("원 ...") displayObject(circle) print("삼각형 ...") displayObject(triangle) print("사각형 ...") displayObject(rectangle)
# -*- coding: utf-8 -*- """ Created on Sat Mar 11 21:00:00 2017 @author: rain """ from CircleFromGeometricObject import Circle from RectangleFromGeometricObject import Rectangle def displayObject(g): print("Area is ",g.getArea()) print("perimeter is",g.getPerimeter()) if isinstance(g,Circle): print("Diameter is",g.getDiameter()) elif isinstance(g,Rectangle): print("Width is ",g.getWidth()) print("Height is ",g.getHeight()) if __name__=="__main__": circle=Circle(1.5) #print("A circle",circle) rectangle=Rectangle(2,4) #print("\nA rectangle",rectangle) print("circle") displayObject(circle) print("rectangle") displayObject(rectangle)
from tkinter import * from CircleFromGeometricObject import Circle s = {3, Circle(45)} print(s)