Computer Science, asked by am5000665, 4 months ago

Write a program in Python script mode to calculate sum and multiplication of no. given by use​

Answers

Answered by pjgaikar06
1

print("HI,")

print("I am PARTH,")

print("Your simple maths bot.")

users_name = input('Whats your name?')

print('Welcome '+users_name+'.')

print("What type of calculation do you want to do today?")

print("")

print("Type 1 for addition")

print("Type 2 for substraction")

print("Type 3 for multiplicaton")

print("Type 4 for division")

print("")

hi = input("Please type the code for calculation=")

if hi == "1":

 print("Addition")

 input1 = input("number1=")

 input2 = input("number2=")

 number1 = int(input1)

 number2 = int(input2)

 result=number1+number2

 output=str(result)

 print(users_name+" your answer is "+output+".")

elif hi == "2":

 print("Substraction")

 input1=input("number1=")

 input2=input("number2=")

 number1=int(input1)

 number2=int(input2)

 result=number1-number2

 output=str(result)

 print(users_name+" your answer is "+output+".")

elif hi == "3":

 print("Multiplication")

 input1=input("number1=")

 input2=input("number2=")

 number1=int(input1)

 number2=int(input2)

 result=number1*number2

 output=str(result)

 print(users_name+" your answer is "+output+".")

elif hi == "4":

 print("Division")

 input1=input("number1=")

 input2=input("number2=")

 number1=int(input1)

 number2=int(input2)

 result=number1/number2

 output=str(result)

 print(users_name+" your answer is "+output+".")

else:

   print("Please type any code given above.")

print("Thank you.")

while True:

 we=input("Do want to calculate again?")

 if we=="no":

   print("Thank you for calculating.")

   break

 elif we == "yes":

   he=input("Please type the code for calculation=")

   print(he)

   if he == "1":

     print("Addition")

     input1=input("number1=")

     input2=input("number2=")

     number1=int(input1)

     number2=int(input2)

     result=number1+number2

     output=str(result)

     print(users_name+" your answer is "+output+".")

   elif he == "2":

       print("Substraction")

       input1=input("number1=")

       input2=input("number2=")

       number1=int(input1)

       number2=int(input2)

       result=number1-number2

       output=str(result)

       print(users_name+" your answer is "+output+".")

   elif he == "3":

         print("Multiplication")

         input1=input("number1=")

         input2=input("number2=")

         number1=int(input1)

         number2=int(input2)

         result=number1*number2

         output=str(result)

         print(users_name+" your answer is "+output+".")

   elif he == "4":

           print("Division")

           input1=input("number1=")

           input2=input("number2=")

           number1=int(input1)

           number2=int(input2)

           result=number1/number2

           output=str(result)

           print(users_name+" your answer is "+output+".")

   else:

       print("Please type any code given above.")

       print("Thank you.")

 else:

       print("Only write yes or no.")

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Similar questions