Advertisement
GroZnik81

circle

Mar 20th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. class Circle:
  2.     def __init__(self, radius):
  3.         self.radius = radius
  4.         self.pi = 3.14
  5.  
  6.     def set_radius(self,new_radius):
  7.         self.radius = new_radius
  8.  
  9.     def get_area(self):
  10.         area = self.pi * self.radius**2
  11.         return area
  12.  
  13.     def get_circumference(self):
  14.         res = 2 * self.radius * self.pi
  15.         return res
  16.  
  17. circle = Circle(10)
  18. circle.set_radius(12)
  19. print(circle.get_area())
  20. print(circle.get_circumference())
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement