a. "apple" with a value of 0.5
b. "banana" with a value of 0.25
c. "orange" with a value of 0.75
2. Update the price of "banana" to 0.3.
3. Add “cherry” to the dictionary with a price of 0.1
4. Add “pear” to the dictionary with a price of 0.7 using another method.
5. Print the modified dictionary.
Right Answer:
# Step 1
prices = {
"apple": 0.5,
"banana": 0.25,
"orange": 0.75
}
# Step 2
prices["banana"] = 0.3
# Step 3
prices["cherry"] = 0.1
# Step 4
prices.update({"pear": 0.7})
# Step 5
print(prices)
# Output: {'apple': 0.5, 'banana': 0.3, 'orange': 0.75, 'cherry': 0.1, 'pear': 0.7}