Advertisement
mixone

7.2

Nov 5th, 2015
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. __author__ = 'Miguel'
  2.  
  3. def addition(a,b):
  4.     return a+b
  5.  
  6. def soustraction(a,b):
  7.     return a-b
  8.  
  9. def multiplication(a,b):
  10.     return a*b
  11.  
  12. def procedure():
  13.     instructions = input()
  14.     instructions = instructions.split()
  15.     for i in range(0, len(instructions), 3):
  16.         a, b, proc = instructions[i:i+3]
  17.         a, b = int(a), int(b)
  18.         if proc == "A":
  19.             print(addition(a, b))
  20.         elif proc == "S":
  21.             print(soustraction(a, b))
  22.         elif proc == "M":
  23.             print(multiplication(a, b))
  24.  
  25. if __name__ == "__main__":
  26.     procedure()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement