From 8af2700377630331cb67862a943a63f5f7f16937 Mon Sep 17 00:00:00 2001 From: Gharke Date: Mon, 25 Nov 2024 06:22:04 -0600 Subject: [PATCH] cleanup --- 2-basics/blockchain.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/2-basics/blockchain.py b/2-basics/blockchain.py index 48cb4db..f83bf1c 100644 --- a/2-basics/blockchain.py +++ b/2-basics/blockchain.py @@ -1,13 +1,25 @@ blockchain = [] def get_last_blockchain_value(): + """ Returns the last value of the current blockchain. """ return blockchain[-1] def add_value(transaction_amount, last_transaction=[1]): + """ Append a new value as well as the last blockchain value + + Arguments: + :transaction_amount: The amount that should be added. + :last_transaction: The last blockchain transaction (default[1]) + """ blockchain.append([last_transaction, transaction_amount]) +def get_user_input(): + return float(input('Your transaction amount please')) + +tx_amount = get_user_input() +add_value(tx_amount) -add_value(5.3) -add_value(2.8, get_last_blockchain_value()) +tx_amount = get_user_input() +add_value(tx_amount, get_last_blockchain_value()) print(blockchain) \ No newline at end of file