Informatics Practices
Assertion (A): Dictionaries are enclosed within curly braces { }.
Reasoning (R): The key-value pairs are separated by commas (,).
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Dictionaries
1 Like
Answer
Both A and R are true but R is not the correct explanation of A.
Explanation
Dictionaries in Python are enclosed within curly braces {}, where each key is separated from its corresponding value by a colon (:), and different key-value pairs are separated by commas.
Answered By
2 Likes
Related Questions
Consider the given code:
D1={1: 'India', 2: 'Russia', 3: 'World'} D2={'School' : 'EOIS' , 'Place ' : 'Moscow'} print(D1.update (D2) )What will be the output of the above code:
- None
- {1: 'India' , 2: 'Russia' , 3: 'World' , 'School' : 'EOIS' , 'Place' : 'Moscow'}
- Error
- None of these
Assertion (A): Dictionary is a collection of key-value pairs.
Reasoning (R): Each key in a dictionary maps to a corresponding value. Keys are unique and act as the index.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): The popitem() method can be used to delete elements from a dictionary.
Reasoning (R): The popitem() method deletes the last inserted key-value pair and returns the value of deleted element.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): Keys of the dictionaries must be unique.
Reasoning (R): The keys of a dictionary can be accessed using values.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.