Calculating accounts receivable (debtors)
When we sell something on credit, the credit portion is in the balance sheet under ‘Accounts Receivable’ or ‘Debtors’. For example, if credit sales are made in January with a 60-day payback period, they would be recorded in our ‘Debtors’ account in January, but only be paid (released) in March, and so on.
In this exercise, we will create the following lists:
- The credit sales in the month
credits
, which in this exercise is 60% of the sale value. - The total accounts receivable
debtors
, to be calculated as the credits for the current month, plus the credits of the month before, minus the credits of two months before (as we assume the credits from 2 months ago or 60 days, will be repaid by then).
We have set an index for the variable month
. The month
value is set at 0.
This exercise is part of the course
Financial Forecasting in Python
Exercise instructions
Create a blank
credits
list and blankdebtors
list.Complete the
for
loop:- Calculate the credit of the month by multiplying the sales value (set to variable
mvalue
) by the percentage credit (60%). - If the
month
is greater than 0, append thedebtors
as current month credits plus credits of prior month. - If the
month
is not greater than 0, append thedebtors
as the current month credits.
- Calculate the credit of the month by multiplying the sales value (set to variable
Print the
debtors
list.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create the list for sales, and empty lists for debtors and credits
sales = [500, 350, 700]
____ = []
____ = []
# Create the statement to append the calculated figures to the debtors and credits lists
for mvalue in sales:
credits.append(mvalue * ____)
if month > 0:
____.append(credits[____] + credits[month-1])
else:
____.append(credits[____])
month += 1
# Print the result
print("The ‘Debtors’ are {}.".format(_____))