Code from the uDemy course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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)
|
|
|
|
|
|
|
|
tx_amount = get_user_input()
|
|
|
|
add_value(tx_amount, get_last_blockchain_value())
|
|
|
|
|
|
|
|
print(blockchain)
|