0
input.txtファイルを作成しました。 input.txtにいくつかのテスト入力日付のセットがあります。それから私はターミナルpython Filename.py <input.txt >output.txt
で走ります。実行した後、私は最初に設定された入力日付の出力を取得します。 output.txtにすべての出力日付を自動的に取得するにはどうすればよいですか?txtファイルでテストする
# GET amount of money in bank
amount_in_bank = input("How much money is in the bank? $")
# GET amount of income
amount_of_income = input("How much income is expected? $")
# GET amount of expenses
amount_of_expenses = input("How much money is going to be spent on expenses? $")
# CALCULATE money in bank + income - expenses
# SET amount available to result of previous calculation
amount_available = int(amount_in_bank) + int(amount_of_income) - int(amount_of_expenses)
# DISPLAY amount available
message = "Bobbie will have $" + str(amount_available) + " left at the end of the month."
print (message)
Pythonコードを共有する –
あなたのプログラムは(それだけであると仮定して)一度何かします。一度それをする部分はどこですか? –
Pythonコードでループが必要なように見えるので、すべての入力を処理します。 – Barmar