like this following example how can i do addition program.
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.
what i need to type in test file ?
1 2 3 4 5 6 7 8 9 10 11 |
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) |
1 2 3 4 5 6 |
from Animals import Mammals from Animals import Birds myMammal = Mammals() myMammal.printMembers() |
1 2 3 4 5 6 7 8 |
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() |