#simple calculator witha all functions function = input('+,-,/,*: ') number1 = input('n1: ') number2 = input('n2: ') if function == '+': sum = number1 + number2 print(sum) elif function == '-': diff = number1 - number2 print(diff) elif function == '*': product = number1 * number2 print(product) elif function =='/': answer = number1 / number2 print(answer) else: print('No related function')
- #simple calculator witha all functions
function = 'add'number1 = 2number2 = 8- function = input('+,-,/,*: ')
- number1 = input('n1: ')
- number2 = input('n2: ')
if function == 'add':- if function == '+':
- sum = number1 + number2
- print(sum)
elif function == 'substract' or 'minus':- elif function == '-':
- diff = number1 - number2
- print(diff)
elif function == 'multiply':- elif function == '*':
- product = number1 * number2
- print(product)
elif function =='divide':- elif function =='/':
- answer = number1 / number2
- print(answer)
- else:
- print('No related function')