Podcast
Questions and Answers
what will be the output of the following code?
d={'Ajay':50,'prem':55,'Rehan':45}
print(len(d))
what will be the output of the following code? d={'Ajay':50,'prem':55,'Rehan':45} print(len(d))
what will be the output of the following code?
d={'Ajay':50,'prem':55,'Rehan':45}
print(list(d.keys()))
what will be the output of the following code? d={'Ajay':50,'prem':55,'Rehan':45} print(list(d.keys()))
items are accessed by their position in a dictionary and all the keys in a dictionary must be of the same type.
items are accessed by their position in a dictionary and all the keys in a dictionary must be of the same type.
False
___________function returns a list of values in the dictionary.
___________function returns a list of values in the dictionary.
Signup and view all the answers
what will be the output of the following code?
a={}
a[2]=5
a[1]=[1,2,3,4]
print(a[1][3])
what will be the output of the following code? a={} a[2]=5 a[1]=[1,2,3,4] print(a[1][3])
Signup and view all the answers
how a new key-value pair is added to a dictionary in python?
how a new key-value pair is added to a dictionary in python?
Signup and view all the answers
what will be the output of the following code?
my_dict={"apple":3,"mango":2,"orange":1}
print(my_dict.get("grape",0))
what will be the output of the following code? my_dict={"apple":3,"mango":2,"orange":1} print(my_dict.get("grape",0))
Signup and view all the answers
to delete the dictionary from the memory we use _______ function
to delete the dictionary from the memory we use _______ function
Signup and view all the answers
how do you remove a key-value pair from a dictionary in python?
how do you remove a key-value pair from a dictionary in python?
Signup and view all the answers
what will be the output of the following code?
my_dict={"apple":3,"mango":2,"orange":1}
print(my_dict.values())
what will be the output of the following code? my_dict={"apple":3,"mango":2,"orange":1} print(my_dict.values())
Signup and view all the answers