Complete the code to define the consensus mechanism used in Proof of Work.
consensus = "[1]"
The consensus mechanism used in Bitcoin and many early blockchains is Proof of Work.
Complete the code to check if the consensus mechanism is energy efficient.
if consensus == "[1]": print("Energy efficient") else: print("Not energy efficient")
Proof of Stake is known for being more energy efficient than Proof of Work.
Fix the error in the code to correctly identify the consensus mechanism that uses voting among nodes.
if consensus == "[1]": print("Uses voting among nodes")
Byzantine Fault Tolerance consensus involves nodes voting to agree on the next block.
Fill both blanks to create a dictionary mapping consensus mechanisms to their main characteristic.
consensus_info = {
"Proof of Work": "[1]",
"Proof of Stake": "[2]"
}Proof of Work consumes high energy, while Proof of Stake is low energy.
Fill both blanks to create a dictionary comprehension filtering consensus mechanisms with energy consumption less than 100.
energy_use = {
"PoW": 1000,
"PoS": 10,
"BFT": 50
}
low_energy = {k: v for k, v in energy_use.items() if v {BLANK_2}} {{BLANK_2}}The dictionary comprehension uses ':' to map keys to values, and filters values less than 100.