balances with exact user names and balancesmin_balance with the exact value 100rich_users to select users with balances greater than min_balancerich_users dictionary exactly as shownbalances with exact user names and balancesmin_balance with the exact value 100rich_users to select users with balances greater than min_balancerich_users dictionary exactly as shownbalances with these exact entries: 'Alice': 150, 'Bob': 90, 'Charlie': 120, 'Diana': 80Use curly braces to create a dictionary with keys as user names and values as their balances.
min_balance and set it to the integer 100Just assign the number 100 to the variable min_balance.
rich_users to select users from balances whose balance is greater than min_balanceUse a dictionary comprehension with for user, bal in balances.items() and an if condition.
print statement to display the rich_users dictionaryUse print(rich_users) to show the dictionary.
What does balance checking in blockchain primarily tell you?
Which of the following is the correct way to call a function getBalance for an address addr in a blockchain library?
?
Given this JavaScript code snippet using a blockchain API:
async function check() {
const balance = await blockchainAPI.getBalance('0x123');
console.log(balance);
}
check();What will be printed if the address has 500 tokens?
Find the error in this Python code that tries to get a balance:
def get_balance(address):
balance = blockchain.getBalance(address)
return balance
print(get_balance)You want to check balances of multiple addresses and store them in a dictionary in Python. Which code correctly does this?
addresses = ['0x1', '0x2', '0x3']
balances = {}
for addr in addresses:
balances[addr] = blockchain.getBalance(addr)
print(balances)Pass the test and this pattern moves unknown