Guest User

Untitled

a guest
Jan 3rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #calculator
  2. def calculate(x , y , op):
  3. if op == '+' :
  4. z = x + y
  5. elif op == '-' :
  6. z = x - y
  7. elif op == '*' :
  8. z = x * y
  9. elif op == '//' :
  10. if y!=0:
  11. z = x // y
  12. else:
  13. print "division not possible"
  14. return z
  15.  
  16. print calculate(9 , 9 , '//')
  17. print calculate(11 , 0 , '//')
Add Comment
Please, Sign In to add comment