in Education by
write a program to implement a simple calculator for two input number . offers choice through a menu in python Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
def summ(): a = n1+n2 print(“The result: “, a) def sub(): s = n1-n2 print(“The result: “, s) def mul(): m = n1*n2 print(“The result: “, m) def div(): d = n1/n2 print(“The result: “, d) n1 = int(input(“Enter 1st number: “)) op = int(input(“1 for addition, 2 for subtraction, 3 for multiplication, 4 for division: “)) n2 = int(input(“Enter 2nd number: “)) if op == 1: summ() elif op == 2: sub() elif op == 3: mul() elif op == 4: div() else: print(“Cannot solve, wrong operator!”)

Related questions

0 votes
    29: Write a program in python to make a simple calculator using function Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
    Write a menu driven program to do the task according to user’s choice: S = 2 – 4 + 8 – 16 + 32 – 64 + …. Up to 15 terms Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    Write a menu driven program to do the task according to user’s choice: S = 2 – 4 + 8 – 16 + 32 – 64 + …. Up to 15 terms. Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    write a program to find the simple intrest, if we input principal, rate, time… formula:si=pxrxt/100 Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    create a four-function calculator. the program requires the user to enter two numbers and an operator. it then ... displays the result Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    create a four-function calculator. the program requires the user to enter two numbers and an operator. it then ... displays the result Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program. A computer manufacturing company offers 20% discount on laptop. If the price of any laptop ... ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program. A computer manufacturing company offers 20% discount on laptop. If the price of any laptop ... discounted price. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    Write a program to input name and percentage of 20 students of class X in two separate one dimensional arrays. ... of the class. Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    write a menu driver program in java for the following pattern ** *** * * * * * * Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
    write a program to input a number and print table of the number using while loop Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    write a program to input number and print wether it is even or odd. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    write a program to input a number. check and display whether it is divisible by 100 Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
...