Advertisement
kgeorgieva

Untitled

Mar 2nd, 2021
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. n = 0
  2. s = '+'
  3.  
  4. m = 0
  5.  
  6. for x in input().split():
  7. if x in ('+', '-', '/', '*'):
  8. s = x
  9. else:
  10. m = int(x)
  11. if s == '+':
  12. n = n + m
  13. if s == '-':
  14. n = n - m
  15. if s == '*':
  16. n = n * m
  17. if s == '/':
  18. if m != 0:
  19. n = n / m
  20. if s == '=':
  21. print(n)
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement