買掛金(creditors)の計算
ここでは、私たちが与信を受ける立場のシナリオを見ていきます。つまり、今すぐ購入できますが、代金の一部は後払いできるということです。
この演習では、T-Z は1月に1,000ユニット、2月に1,200ユニットを生産するためにナットとボルトを購入する必要があります。ナットとボルトの単価は0.25 USDです。与信条件は、前払い50%、30日後に50%です。
したがって、この場合の買掛金は翌月に支払われます。つまり、買掛金の金額は当月に発生した与信仕入分のみを反映します。
この演習はコースの一部です
Pythonで学ぶファイナンシャル・フォーキャスティング
演習の手順
単価を設定します。
1月と2月の生産数量を含む
productionリストと、空のcreditorsリストを作成します。1月と2月の買掛金
creditorsを計算します。- そのために、
productionの各ユニット数量(mvalue)に対して、単価と与信条件(0.5)を掛けた値を.append()メソッドで追加します。
- そのために、
1月と2月の
creditors残高を表示します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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]))