Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import isnan
- print('Calculator 1.0')
- try:
- firstOperand = input('Enter first number:')
- except:
- print('Not a number')
- try:
- secondOperand = input('Enter second number')
- except:
- print('Not a number')
- try:
- operand = input('Enter the operation:')
- except:
- print('Not a number')
- while True:
- if operand == '+':
- print (float(firstOperand) +float(secondOperand))
- if operand == '-':
- print (float(firstOperand) -float(secondOperand))
- if operand == '*':
- print (float(firstOperand) *float(secondOperand))
- if operand == '%':
- print (float(firstOperand) /float(secondOperand))
- else:
- print('Invalid parameters')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement