Advertisement
SpasSpasov

Account Balance

May 18th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. transactions = int(input())
  2.  
  3. bank_sum = 0
  4.  
  5. counter_transaction = 0
  6.  
  7. while counter_transaction < transactions:
  8.     current_sum = float(input())
  9.  
  10.     if current_sum < 0:
  11.         print('Invalid operation!')
  12.         break
  13.  
  14.     print(f'Increase: {current_sum:.2f}')
  15.     bank_sum += current_sum
  16.     counter_transaction += 1
  17.  
  18.  
  19. print(f'Total: {bank_sum:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement