Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1ledger | Arecord = ("Ava", "Liam", 20) | |
| 2balance = total_in - total_out | BThe records only list names. A ledger record must also show how much was paid, so the amount is missing. | |
| 3A ledger holds one record for each transaction, so the records form a list | CA record book that lists every transaction, showing who paid whom and how much | |
| 4A ledger entry shows who paid whom and how much | DClearing the ledger deletes every record. A ledger must keep an accurate history of all transactions, so records must not be wiped. | |
| 5ledger = ["Ava", "Liam"] | Eledger = [t1, t2, t3] | |
| 6ledger = [t1, t2] ledger.clear() | FWorking out how much money someone has by adding up the ledger records |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ledger — A record book listing every transaction, so you can see who paid whom and how much. It is used to work out balances and keep an accurate history.ledger ← []balance ← 100
FOR EACH t IN ledger
balance ← balance + t.amounttotal ← 0
FOR EACH t IN ledger
total ← total + t.amountledger ← [t1, t2, t3]
OUTPUT LENGTH(ledger)FOR EACH t IN ledger
OUTPUT t.payer, "paid", t.payee, t.amount