Case 1
unknown
plain_text
4 years ago
2.0 kB
7
Indexable
import os os.system('clear') print('**************************') print(' MATHLETE CALCULATOR ') print('__________________________') print('add | Add two numbers ') print('sub | Subtract two numbers') print('mul | Multiply two numbers') print('div | Divide two numbers ') print('__________________________') selection = input('Selection: ') print('__________________________') print('Calculating "c" for expression:' ) a = 0 b = 0 while selection == 'add': print(' ') print(' a + b = c ') print(' ') print('Please, enter values for "a" and "b"') print(' ') a = int(input('a = ')) b = int(input('b = ')) add = a + b print(' ') print('RESULT: ', a, '+', b, '=', add) if selection == 'sub': print(' ') print(' a - b = c ') print(' ') print('Please, enter values for "a" and "b"') print(' ') a = int(input('a = ')) b = int(input('b = ')) sub = a - b print(' ') print('RESULT: ', a, '-', b, '=', sub) elif selection == 'mul': print(' ') print(' a * b = c ') print(' ') print('Please, enter values for "a" and "b"') print(' ') a = int(input('a = ')) b = int(input('b = ')) mul = a * b print(' ') print('RESULT: ', a, '*', b, '=', mul) elif selection == 'div': print(' ') print(' a / b = c ') print(' ') print('Please, enter values for "a" and "b"') print(' ') a = int(input('a = ')) b = int(input('b = ')) div = a / b print(' ') print('RESULT: ', a, '/', b, '=', div) input('Press enter to continue...')
Editor is loading...