Question 1
What is the purpose of the values() method in python dictionaries?
Question 2
Which method can you use to retrieve both keys and values from a dictionary as pairs?
Question 3
What is the result of the following code?
my_dict={apple: 3, banana: 2, cherry: 5};
print(my_dict[pear])
Question 4
How do you access the value associated with a specific key in a dictionary?
Question 5
How can you access the value associated with a key if the key exists, and if it doesnt, return a default value of 0?
Question 6
Which of the following is a valid way to check if a key exists in a dictionary before accessing it?
Question 7
What happens if you try to access a key that doesnt exist in a dictionary using indexing?
Question 8
How can you access all the keys in a dictionary as a list?
Question 9
How can you provide a default value when accessing a key that may not exist in a dictionary?
Question 10
What is the result of the following code?
my_dict={apple: 3, banana: 2, cherry: 5}
flag=apple" in my_dict
print(flag)