"mathematics.py - ENhushbu/mathematics.py (3.12.
2)*
File Edit Format Run Options Window Help
#write a python [rogram to create a module name mathematics which include the following methods 1.addition 2. subtraction 3.multiply 4.divisionA
def addition (a, b) :
X=a+b
print ("addition : ", x)
def subtract (a,b) :
X=a-b
print ("subtraction : ",x)
def division (a, b):
X=a/b
print ("division: ",x)
def multiply (a, b):
X-a*b
print ("multiply : ",x)
def remainder (a, b) :
X=atb
print ("remainder: ",x)
def squareroot (a) :
X=a**0.5
print ("squareroot: ",)
def cuberoot (a) :
X=a** (1/3)
print ("cuberoot : ", x)
def power (a, b) :
X-a**b
print ("power:",x)
Ln: 23 Cot: 27
1 32*C ENG 1549
Haze
Q Search IN
12-03-2n
3-2024
mapy -E/khushbu/ma.py (3.122)
File Edit Format Run Options Window Help
import mathematics as ma
print("1. addition 2.subtraction 3. divsion 4.multiply 5.remainder 6.squareroot 7.cuberoot 8.power 9.exit ")
n=int (input ("enter your choice :" ))
while (n!=9) :
if n==1:
a-int (input ("enter first number : "))
b=int (input ("enter second number : "))
ma.addition (a, b)
elif n==2:
a=int (input ("enter first number : "))
b=int (input ("enter second number : "))
ma.subtract (a, b)
elif n==3:
a=int (input ("enter first number : ")
b=int (input ("enter second number : "))
ma.division (a, b)
elif n==4:
a=int (input ("enter first number : "))
b=int (input ("enter second number : "))
ma .multiply (a, b)
elif n==5:
a=int (input ("enter first number : ")
b=int (input ("enter second number: "))
ma.remainder (a, b)
elif n==6:
a=int (input ("enter first number : "))
ma. squareroot (a,b)
elif n=7:
a=int (input ("enter first number : "))
ma. cuberoot (a)
elif n=-8:
a=int (input ("enter first number : ")
b=int (input ("enter second number : "))
ma.power (a, b)
else:
print (""exiting.....")
h=int (input ("enter your choice :"))
Ln: 37 Col: 4
32C ENG
Haze Q Search T 1549
IN 12-03-2024
"IDLE Shell 3.12.2* X
le Edit Shell Debug Options Window Help
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:15:12) [MSC v.1937 32 bit (Intel) ] on win32
Type "help", "copyright", "credits" or "license () " for more information.
>>
RESTART: E:/khushbu/ma.py
1.addition 2.subtraction 3.divsion 4.multiply 5.remainder 6.squareroot 7.cuberoot 8.power 9.exit
enter your choice :1
enter first number : 23
enter second number : 56
addition : 79
enter your choice :2
enter first number : 34
enter second number : 23
subtraction : 11
enter your choice :3
enter first number : 20
enter second number : 10
division: 2.0
enter your choice :4
enter first number : 30
enter second number : 6
multiply : 180
enter your choice :5
enter first number : 40
enter second number: 2
remainder: 0
enter your choice :6
enter number : 4
Squareroot :
enter your choice :8
enter first number
enter second number : 2
power: 64
enter your choice :7
enter number : 8
cuberoot : 2.0
enter your choice :
Ln: 36 Col: 19
132*C Q Search
ENG
Haze IN 12-03-2024