Informatics Practices
What is a key-value pair in dictionary?
Python Dictionaries
2 Likes
Answer
A key-value pair in a dictionary is an association of a key and its corresponding value.
Answered By
2 Likes
Related Questions
Assertion (A): Items in dictionaries are unordered.
Reasoning (R): You may not get back the data in the same order in which you had entered the data initially in the dictionary.
- 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): Consider the code given below:
d={1: 'Amit', 2: 'Sumit', 5:'Kavita'} d.pop(1) print(d)The output will be:
Amit #item is returned after deletion {2: 'Sumit', 5: 'Kavita'}Reasoning (R): pop() method not only deletes the item from the dictionary but also returns the deleted value.
- 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.
What are the differences between strings and dictionary?
Find errors and rewrite the same after correcting the following code:
d1 = {1:10, 2.5:20, 3:30, 4:40, 5:50, 6:60, 7:70}