0
0
Blockchain / Solidityprogramming~30 mins

Balance checking in Blockchain / Solidity - Mini Project: Build & Apply

Choose your learning style9 modes available
Balance checking
📖 Scenario: You are building a simple blockchain wallet app. Users have balances stored in a dictionary. You want to check how much balance each user has.
🎯 Goal: Create a program that stores user balances, sets a minimum balance threshold, finds users with balances above that threshold, and prints their names and balances.
📋 What You'll Learn
Create a dictionary called balances with exact user names and balances
Create a variable called min_balance with the exact value 100
Use a dictionary comprehension called rich_users to select users with balances greater than min_balance
Print the rich_users dictionary exactly as shown
💡 Why This Matters
🌍 Real World
Blockchain wallets need to check user balances to show available funds or to decide if a user can make a transaction.
💼 Career
Understanding how to filter and display balances is important for blockchain developers working on wallet apps or financial dashboards.
Progress0 / 4 steps
1
DATA SETUP: Create the user balances dictionary
Create a dictionary called balances with these exact entries: 'Alice': 150, 'Bob': 90, 'Charlie': 120, 'Diana': 80
Blockchain / Solidity
Need a hint?

Use curly braces to create a dictionary with keys as user names and values as their balances.

2
CONFIGURATION: Set the minimum balance threshold
Create a variable called min_balance and set it to the integer 100
Blockchain / Solidity
Need a hint?

Just assign the number 100 to the variable min_balance.

3
CORE LOGIC: Select users with balances above the threshold
Use a dictionary comprehension called rich_users to select users from balances whose balance is greater than min_balance
Blockchain / Solidity
Need a hint?

Use a dictionary comprehension with for user, bal in balances.items() and an if condition.

4
OUTPUT: Print the rich users dictionary
Write a print statement to display the rich_users dictionary
Blockchain / Solidity
Need a hint?

Use print(rich_users) to show the dictionary.