Codio challenge python
Final challenge
For your final challenge in this unit, you will load two files. The first file F1 will have information about some accounts. It will be pipe-delimited and have one record per line, with these fields:
ACCOUNT NUMBER | PIN CODE | BALANCE
The second file F2 will contain instructions: one on each line. The instructions will look like this:
COMMAND | AMOUNT | ACCOUNT NUMBER | PIN CODE
COMMAND will be either add or sub. If the command is add, you will add AMOUNT to the BALANCE in the account files F1. If the command is sub, you will subtract.
However, there are a number of reasons for which you may need to reject the transaction. If you are asked to subtract an amount that would put the account below zero or if the pin code you are provided does not match the pin code in the account record, the transaction is ignored.
Account Transactions
Given pipe-delimited filesF1 andF2 whereF1 contains accounts with fields ACCOUNT NUM|PIN|BALANCE andF2 contains transaction instructions COMMAND|AMOUNT|ACCOUNT NUM|PIN, execute the transactions, storing the results back inF1.
The COMMAND field will be add or subindicating addition or subtraction from the account.
Transactions which do not provide the correct PIN code or attempt to put the account below zero should be ignored.
# Get the filepath from the command line
import sys
F1= sys.argv[1]
F2= sys.argv[2]