ComeçarComece de graça

Calculating accounts payable (creditors)

Now we will look at a scenario where we are the ones being granted credit. This means that we can buy something, but only have to pay for this amount later.

In this exercise, T-Z needs to buy nuts and bolts to produce 1000 units in January and 1200 units in February. The cost of nuts and bolts per unit is 0.25 USD. The credit terms are 50% cash upfront and 50% in 30 days.

Therefore, the creditors' value, in this case, would be paid the month directly after. This means that the creditors' value would only reflect the current month's credit purchases.

Este exercício faz parte do curso

Financial Forecasting in Python

Ver curso

Instruções do exercício

  • Set the cost per unit.

  • Create the list for production production including the unit amounts for January and February, as well as an empty creditors list.

  • Calculate the accounts payable creditors for January and February.

    • To do this, use the .append() method for each quantity of units (mvalue) in production, multiplied by the unit cost and credit terms (0.5).
  • Print the creditors balance for January and February.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Set the cost per unit
unit_cost = ____

# Create the list for production units and empty list for creditors
production = [____,____]
creditors = ____

# Calculate the accounts payable for January and February
for mvalue in ____: 
    creditors.____(mvalue * ____ * 0.5)
    
# Print the creditors balance for January and February
print("The creditors balance for January and February are {} and {} USD.".format(____[0], ____[1]))
Editar e executar o código