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"])
Answer
Output
2000
1500
Explanation
- The dictionary
maintenancestores key–value pairs. maintenance["car"]accesses the value associated with the key"car", which is2000.maintenance["Filter"]accesses the value associated with the key"Filter", which is1500.- Hence, the output is:
2000
1500
Related Questions
Identify suitable data type(s). One has been done for you.
Scenario Data Type Storing area of square int, float Storing age of a person Storing age, height and weight in a single data type Storing age, height and weight in a single data type (It should not be changed, once stored) Storing age, height and weight in a single data type (index name should reflect that the data corresponds to age, height, and weight) Python is an important language for data analysis.
Python is popular due to its simplicity and strong libraries.
The object-oriented programming (OOP) paradigm organises data and functions into reusable structures.