All pastes #333628 Raw Edit

Stuff

public text v1 · immutable
#333628 ·published 2007-01-31 00:48 UTC
rendered paste body
class circleArea:
	"""Simple example code for finding circle area"""
	
	def __init__(self):
		"""Initailiaze the object"""
		self.r=input("Please enter radius of circle::")
		self.calculate(self.r)
		self.printGlobal()
		
	def calculate(self, rad):
		"""perform calculation"""
		self.area = rad*rad*3.14
		self.perimeter =2*3.14*rad
		print("Area of circle: %f") % self.area
		print("Perimeter of circle: %f") % self.perimeter
	
	def printGlobal(self):
		"""proving that the self.area is globally defined"""
		print("Proving global variable: %f") % self.area
		

circ = circleArea()