Robotics & Artificial Intelligence

What would be the output of following Python code snippet:

maintenance ={"car" : 2000, "furniture" : 1000, "Filter" : 1500}
print(maintenance["car"])
print(maintenance["Filter"])

Getting Started

4 Likes

Answer

Output
2000
1500
Explanation
  • The dictionary maintenance stores key–value pairs.
  • maintenance["car"] accesses the value associated with the key "car", which is 2000.
  • maintenance["Filter"] accesses the value associated with the key "Filter", which is 1500.
  • Hence, the output is:
2000
1500

Answered By

1 Like


Related Questions