def main(): circle1 = Circle() print("The area of th circle of radius", circle1.radius, "is", circle1.getArea()) circle2 = Circle(25) print("The area of th circle of radius", circle2.radius, "is", circle2.getArea())
def main(): circle1 = Circle() # 반지름 1인 원을 생성한다. print("반지름이", circle1.radius, "인 원의 넓이는 ", circle1.getArea(), "입니다.") circle2 = Circle(25) # 반지름 25인 원을 생성한다. print("반지름이", circle2.radius, "인 원의 넓이는 ", circle2.getArea(), "입니다.") circle3 = Circle(125) # 반지름 125인 원을 생성한다. print("반지름이", circle3.radius, "인 원의 넓이는 ", circle3.getArea(), "입니다.") circle2.radius = 100 # 반지름을 100으로 다시 설정 print("반지름이", circle2.radius, "인 원의 넓이는 ", circle2.getArea(), "입니다.")
def main(): #创建一个半径为1的圆 circle1 = Circle() #初始化的self的圆半径就是1 print("The area of the circle of radius:", circle1.radius, "is", circle1.getArea()) circle2 = Circle(25) print("The area of the circle of radius:", circle2.radius, "is", circle2.getArea()) circle2.radius = 100 print("The area of the circle of radius:", circle2.radius, "is", circle2.getArea())
def main(): c1 = Circle() print("Radius: ", c1.radius, "Circle1 Area:", c1.getArea()) c2 = Circle(25) print("Radius: ", c2.radius, "Circle2 Area:", c1.getArea()) c3 = Circle(125) print("Radius: ", c3.radius, "Circle3 Area:", c1.getArea()) c2.radius = 100 print("Radius: ", c2.radius, "Circle2 Area:", c2.getArea()) c1.setRadius(50) print("Radius: ", c1.radius, "Circle1 Area:", c1.getArea())
def main(): # Create a circle with radius 1 circle1 = Circle() print("the area of the circle of radius", circle1.radius, "is", circle1.getArea()) circle2 = Circle(25) print("the area of the circle of radius", circle2.radius, "is", circle2.getArea()) circle3 = Circle(125) print("the area of the circle of radius", circle3.radius, "is", circle3.getArea()) # modify circle radius circle2.radius = 100 print("the area of circle of radius", circle2.radius, "is", circle2.getArea())
def main(): # Create a circle with radius 1 circle1 = Circle() print("반지름이 ", circle1.radius, "인 원의 넓이는 ", circle1.getArea(), "입니다.") # Create a circle with radius 25 circle2 = Circle(25) print("반지름이 ", circle2.radius, "인 원의 넓이는 ", circle2.getArea(), "입니다.") # Create a circle with radius 125 circle3 = Circle(125) print("반지름이 ", circle3.radius, "인 원의 넓이는 ", circle3.getArea(), "입니다.") # Modify circle radius circle2.radius = 100 print("반지름이 ", circle2.radius, "인 원의 넓이는 ", circle2.getArea(), "입니다.")
def main(): radius = int(input()) width = int(input()) height = int(input()) color1 = input() filled1 = input() color2 = input() filled2 = input() circle = Circle(radius) circle.setColor(color1) circle.setFilled(filled1) print("Circle:") print("Radius is", circle.getRadius()) print("Diameter is", circle.getDiameter()) print("Area is", circle.getArea()) print("Perimeter is", circle.getPerimeter()) print(circle) print() rectangle = Rectangle(width, height) rectangle.setColor(color2) rectangle.setFilled(filled2) print("Rectangle:") print("Width is", rectangle.getWidth()) print("Height is", rectangle.getHeight()) print("Area is", rectangle.getArea()) print("Perimeter is", rectangle.getPerimeter()) print(rectangle)
def main(): circle1 = Circle() print("The area of the circle of radius", circle1.radius, "is", circle1.getArea()) circle2 = Circle(25) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea()) circle3 = Circle(125) print("The area of the circle of radius", circle3.radius, "is", circle3.getArea()) circle2.radius = 100 print("The area of the circle of radius", circle2.radius, "is", circle2.getArea())
def main(): # Create a circle with radius 1 circle1 = Circle() print("The area of the circle of radius", circle1.radius, "is", circle1.getArea()) # Create a circle with radius 25 circle2 = Circle(25) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea()) # Create a circle with radius 125 circle3 = Circle(125) print("The area of the circle of radius", circle3.radius, "is", circle3.getArea()) # Modify circle radius circle2.radius = 100 print("The area of the circle of radius", circle2.radius, "is", circle2.getArea())
def main(): # Create a circle with radius 1 circle1 = Circle() print("The area of the circle of radius", circle.radius, "is", circle1.getArea()) # Create a circle wirh radius 25 circle2 = Circle(25) print("The area of the circle of radius", circle2.radius, "is", circle2.gerArea()) # Create a circle with radius 125 circle3 = Circle(125) print("The area of the circle of radius", circle3.radius, "is", circle3.getArea()) # Modify circle radius circle2.radius = 100 # or circle2.setRadius(100) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea())
def main(): circle = Circle(1.5) print("A circle", circle) print("The radius is", circle.getRadius()) print("The area is", circle.getArea()) 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(): # Create a circle with radius 1 circle1 = Circle() print("The area of the circle of radius", circle1.radius, "is", circle1.getArea()) # Create a circle with radius 25 circle2 = Circle(25) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea()) # Create a circle with radius 125 circle1 = Circle(125) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea()) # modify circle2 radius, two ways to do it circle2.radius = 100 circle2.setRadius(111) print("The area of the circle of radius", circle2.radius, "is", circle2.getArea())
def main(): # Create a circle with radius 1 circle1 = Circle() print("The area of the circle of radius {0:>3} is {1}.".format( circle1.radius, circle1.getArea())) # Create a circle with radius 25 circle2 = Circle(25) print("The area of the circle of radius {:>3} is {}.".format( circle2.radius, circle2.getArea())) # Create a circle with radius 125 circle3 = Circle(125) print() print("The area of the circle of radius {:>3} is {}.".format( circle3.radius, circle3.getArea())) # Modify circle radius circle2.radius = 100 # or circle2.setRadius(100) print("The area of the circle of radius {:>3} is {}.".format( circle2.radius, circle2.getArea()))
def main(): # Create a circle with Radius 1 circle1 = Circle() print("The area of the circle of Radius", circle1.Radius, "is", circle1.getArea()) # Create a circle with Radius 25 circle2 = Circle(25) print("The area of the circle of Radius", circle2.Radius, "is", circle2.getArea()) # Create a circle with Radius 125 circle3 = Circle(125) print("The area of the circle of Radius", circle3.Radius, "is", circle3.getArea()) # Modify circle Radius circle2.Radius = 100 print("The area of the circle of Radius", circle2.Radius, "is", circle2.getArea()) circle4 = circle1 + circle2 print("The sum of circles 1 and 2 are: ", circle4)
def main(): c1 = Circle() c1.setRadius(10) print 'the area of the circle of radius', c1.radius, 'is', c1.getArea()
import sys sys.path.append(r'/home/irene/Documents/python/Class') from Circle import Circle import time print(time.strftime('%H:%M:%S',time.localtime(time.time()))) c = Circle(5) print("Radius:",c.radius) print("Perimeter:",c.getPerimeter()) print("Area:",c.getArea())
from Circle import Circle from Rectangle import Rectangle radius = input() width = input() height = input() cc = input() cf = input() rc = input() rf = input() c = Circle(radius, cc, cf) r = Rectangle(width, height, rc, rf) print("Circle:\nRadius is {}\nDiameter is {}\nArea is {}\nPerimeter is {}". format(c.getRadius(), c.getDiameter(), c.getArea(), c.getPerimeter(), end='')) c.__str__() print("Rectangle:\nWidth is {}\nHeight is {}\nArea is {}\nPerimeter is {}". format(r.getWidth(), r.getHeight(), r.getArea(), r.getPerimeter(), end='')) r.__str__()
from GeometricObject import GeometricObject from Circle import Circle from Rectangle import Rectangle circleRadius = int(input()) rectangleWidth = int(input()) rectangleHeight = int(input()) circleColor = str(input()) circleFilled = bool(input()) rectangleColor = str(input()) rectangleFilled = bool(input()) cir = Circle(circleRadius, circleColor, circleFilled) rect = Rectangle(rectangleWidth, rectangleHeight, rectangleColor, rectangleFilled) print("Circle:") print("Radius is {0}\nDiameter is {1}\nArea is {2}\nPerimeter is {3}".format(cir.getRadius(),\ cir.getDiameter(), cir.getArea(), cir.getPerimeter())) #print("color: %s and filled: %s"%(cir.getColor(), cir.isFilled())) print("\nRectangle:") print("Width is {0}\nHeight is {1}\nArea is {2}\nPerimeter is {3}\ncolor: {4} and filled: {5}".format(\ rect.getWidth(), rect.getHeight(), rect.getArea(), rect.getPerimeter(), rect.getColor(), rect.isFilled()))
from Rectangle import Rectangle from Circle import Circle if __name__ == '__main__': circle = Circle(int(input())) rectangle = Rectangle(int(input()), int(input())) circle.setColor(input()) circle.setFilled(bool(input())) rectangle.setColor(input()) rectangle.setFilled(bool(input())) print('Circle:') print('Radius is ', circle.getRadius()) print('Diameter is ', circle.getDiameter()) print('Area is ', circle.getArea()) print('Perimeter is ', circle.getPerimeter()) print(circle) print('Rectangle:') print('Width is ', rectangle.getWidth()) print('Height is ', rectangle.getHeight()) print('Area is ', rectangle.getArea()) print('Perimeter is ', rectangle.getPerimeter()) print(rectangle)
# Class: 1321L # Sec: 02 # Lab: Python # Term: Fall 2018 # Instructor: Malcolm # Name: Ly Pham from Circle import Circle circle1 = Circle() print('Print radius:','\n','The radius is '+str(circle1.getRadius())+str('.')) print('Print area:','\n','The area is '+str(round(circle1.getArea(),2))+str('.')) print('Print perimeter:','\n','The perimeter is ' + str(round(circle1.getPerimeter(),2))+str('.')) print('\n') circle2 = Circle() circle2.setRadius(10) print('Set radius to 10 and print the object:','\n',str(circle2.toString())+str('.')) print('Print area:','\n','The area is '+str(round(circle2.getArea(),2))+str('.')) print('Print perimeter:','\n','The perimeter is ' + str(round(circle2.getPerimeter(),2))+str('.'))
from Rectangle import Rectangle from Circle import Circle radius = int(input()) w = int(input()) h = int(input()) circleColor = str(input()) circleFilled = bool(input()) rectColor = str(input()) rectFilled = bool(input()) circle = Circle(radius, circleColor, circleFilled) rect = Rectangle(w, h, rectColor, rectFilled) print("Circle:") print("Radius is {}\nDiameter is {}\nArea is {}\nPerimeter is {}".format( circle.getRadius(), circle.getDiameter(), circle.getArea(), circle.getPerimeter())) circle.__str__() print("Rectangle:") print("Width is {}\nHeight is {}\nArea is {}\nPerimeter is {}".format( rect.getWidth(), rect.getHeight(), rect.getArea(), rect.getPerimeter())) rect.__str__()
# -*- coding: utf-8 -*- """ Created on Tue Jun 9 22:11:35 2020 @author: mushroom """ from GeometricObject import GeometricObject from Circle import Circle from Rectangle import Rectangle cr = int(input()) rw = int(input()) rh = int(input()) cc = str(input()) cf = bool(input()) rc = str(input()) rf = bool(input()) c = Circle(cr, cc, cf) r = Rectangle(rw, rh, rc, rf) print("Circle:") print("Radius is {0}\nDiameter is {1}\nArea is {2}\nPerimeter is {3}"\ .format(c.getRadius(),c.getDiameter(), c.getArea(), c.getPerimeter())) print("color: %s and filled: %s" % (c.getColor(), c.isFilled())) print("\nRectangle:") print("Width is {0}\nHeight is {1}\nArea is {2}\nPerimeter is {3}\ncolor: {4} and filled: {5}"\ .format(r.getWidth(), r.getHeight(), r.getArea(), r.getPerimeter(), r.getColor(), r.isFilled()))