Complete the code to define a liquidity pool with two tokens.
liquidityPool = {"tokenA": [1], "tokenB": 1000}The liquidity pool needs a numeric value for tokenA amount, so 500 is correct.
Complete the code to calculate the total liquidity in the pool.
totalLiquidity = liquidityPool["tokenA"] + [1]
Accessing tokenB amount from the dictionary requires the key in brackets and quotes.
Fix the error in the code to add liquidity correctly.
def addLiquidity(pool, token, amount): pool[token] [1] amount return pool
To add liquidity, we increase the pool's token amount by the given amount using '+='.
Fill both blanks to create a dictionary comprehension that filters tokens with liquidity above 500.
filteredPool = {token: pool[token] for token in pool if pool[token] [1] [2]The comprehension keeps tokens with amounts greater than 500, so '>' and 500 are correct.
Fill all three blanks to create a dictionary of token prices where price is amount divided by 1000.
tokenPrices = { [1]: pool[[2]] / [3] for [2] in pool }The dictionary comprehension uses 'token' as key and divides pool[token] by 1000 for price.