Advertisement
Guest User

Untitled

a guest
May 4th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. from math import isnan
  2. print('Calculator 1.0')
  3. try:
  4.     firstOperand = input('Enter first number:')
  5. except:
  6.     print('Not a number')
  7.    
  8. try:
  9.     secondOperand = input('Enter second number')
  10.    
  11. except:
  12.     print('Not a number')
  13.    
  14. try:
  15.     operand = input('Enter the operation:')
  16.    
  17. except:
  18.     print('Not a number')
  19.    
  20. while True:
  21.     if operand == '+':
  22.         print (float(firstOperand) +float(secondOperand))
  23.        
  24.     if operand == '-':
  25.         print (float(firstOperand) -float(secondOperand))
  26.        
  27.     if operand == '*':
  28.         print (float(firstOperand) *float(secondOperand))
  29.        
  30.     if operand == '%':
  31.         print (float(firstOperand) /float(secondOperand))
  32.        
  33. else:
  34.     print('Invalid parameters')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement