Advertisement
piotrirving

Class Question

May 27th, 2020
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. class Circle:
  2.   pi = 3.14
  3.   def __init__(self, diameter):
  4.     print("Creating circle with diameter {d}".format(d=diameter))
  5.     # Add assignment for self.radius here:
  6.    
  7.     self.radius = diameter / 2
  8.    
  9.   def circumference(self):
  10.     return 2 * self.pi * self.radius
  11.  
  12. vs
  13.  
  14. class Circle:
  15.   pi = 3.14
  16.   def __init__(self, diameter):
  17.     print("Creating circle with diameter {d}".format(d=diameter))
  18.     # Add assignment for self.radius here:
  19.    
  20.   def readius(self):
  21.     radius = self.diameter / 2
  22.    
  23.   def circumference(self):
  24.     return 2 * self.pi * self.radius
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement