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.

25 lines
718 B

2 months ago
blockchain = []
def get_last_blockchain_value():
2 months ago
""" Returns the last value of the current blockchain. """
2 months ago
return blockchain[-1]
def add_value(transaction_amount, last_transaction=[1]):
2 months ago
""" 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])
"""
2 months ago
blockchain.append([last_transaction, transaction_amount])
2 months ago
def get_user_input():
return float(input('Your transaction amount please'))
tx_amount = get_user_input()
add_value(tx_amount)
2 months ago
2 months ago
tx_amount = get_user_input()
add_value(tx_amount, get_last_blockchain_value())
2 months ago
print(blockchain)