Advertisement
xah

X: Transactions

xah
Mar 29th, 2017 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. transaction = input()
  2.  
  3. while transaction:
  4.     if transaction == '0 W 0':
  5.         break
  6.  
  7.     transaction = transaction.split(' ')
  8.  
  9.     if transaction[1] == 'W':
  10.         money = int(transaction[0]) - int(transaction[2])
  11.     else:
  12.         money = int(transaction[0]) + int(transaction[2])
  13.  
  14.     if money < -200:
  15.         print('Not allowed')
  16.     else:
  17.         print(money)
  18.  
  19.     transaction = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement