class Numbers:
#Class name and declaration
def __init__(self,number):
#Initializing class members
self.number = number
def find_number_type(self):
if self.number % 2 == 0:
print "Even"
else:
print "Odd"
#End of class construct
num1 = Numbers(100)
#Creating class object
num1.find_number_type()
#Calling class function
Comments
Post a Comment