Python Program to perform all arithmetic operations in menu


print(''' main menu

1.add

2.sub

3.div

4.milt

5.exit''')

n1=int(input('enter any n1'))

n2=int(input('enter any n2'))

while True:

  ch=int (input('enter your choice'))

  if ch==1:

    print(n1+n2)

  elif ch==2:

    print(n1-n2)

  elif ch==3:

    print(n1*n2)

  elif ch==4:

    print(n1/n2)

  elif ch==5:

    print('you have exited!')

    break

  else:

    print('invalid choses')

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.

Python Program which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line