print('Now, the area of the rectangle is '+str(my_rect.get_area())+'.') my_rect.draw_shape() #Draw the rectangle time.sleep(1) #Wait 1 second my_rect.set_height(200) print('Now, the area of the rectangle is '+str(my_rect.get_area())+'.') time.sleep(1) #Wait 1 second ''' ############################### # SQUARE # ############################### my_square = Square(50) my_square.set_length(10) print('The area of the square is ' + str(my_square.get_area()) + '.') my_square.draw_shape() #Draw the square time.sleep(1) #Wait 1 second my_square.set_length(50) print('Now, the area of the square is ' + str(my_square.get_area()) + '.') time.sleep(1) #Wait 1 second my_square.set_height(100) print('Now, the area of the square is ' + str(my_square.get_area()) + '.') time.sleep(1) #Wait 1 second turtle.mainloop()
ellipse_obj = Ellipse() while True: print() print("Shapes Available to draw:","1. Line", "2. Rectangle", "3. Square", "4. Circle", "5. Triangle", "6. Ellipse","7. Pentagon","8. Exit", sep='\n',end='\n') try: num = int(input("Enter your choice: ")) except: print() print("Give correct input.") continue print() if num < 1 or num > 7: print("Incorrect choice, Choose from 1 to 7:") continue if num == 1: line_obj.draw_shape() elif num == 2: rectangle_obj.draw_shape() elif num == 3: square_obj.draw_shape() elif num == 4: circle_obj.draw_shape() elif num == 5: triangle_obj.draw_shape() elif num == 6: ellipse_obj.draw_shape() else: print("Thank you...!") break