Mar-28-2018, 01:13 PM
like this following example how can i do addition program.
class Mammals: def __init__(self): ''' Constructor for this class. ''' # Create some member animals self.members = ['Tiger', 'Elephant', 'Wild Cat'] def printMembers(self): print('Printing members of the Mammals class') for member in self.members: print('\t%s ' % member)
from Animals import Mammals from Animals import Birds myMammal = Mammals() myMammal.printMembers()like this i want to create addition,sub program where i type following program for addition but i want to put 2 addition numbers in test.py programs insted of taking 2 no's in shell.
class addition: def add(): a=int(input("Enter the number : ")) b=int(input("Enter the number two : ")) c= a + b print(c) obj = addition.add()what i need to type in test file ?