Which of the following statements about tuples in Python is true?
What is the key difference between a dictionary and a list in Python?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following methods is used to add an element to a set in Python?
What will be the output of the following code?
my_tuple = (1, 2, 3, 4, 5)
print(my_tuple[2])
Which of the following statements about sets in Python is true?
What will be the output of the following code?
my_dict = {'name': 'John', 'age': 25, 'city': 'New York'}
print(my_dict.get('address'))
What will be the output of the following code?
my_set = {1, 2, 3, 4, 5}
my_set.add(6)
print(len(my_set))
What will be the output of the following code?
my_tuple = ('apple', 'banana', 'cherry')
my_tuple[0] = 'orange'
print(my_tuple)
What will be the output of the following code?
my_dict = {'name': 'John', 'age': 25, 'city': 'New York'}
del my_dict['age']
print(my_dict)
What will be the output of the following code?
my_set = {1, 2, 3, 4, 5}
my_set.remove(6)
print(my_set)
Given two sets: set1 = {1, 2, 3, 4, 5} and set2 = {4, 5, 6, 7}, which code snippet can be used to find the elements common to both sets?
What will be the output of the following code?
my_dict = {'a': 1, 'b': 2, 'c': 3}
result = my_dict.pop('b')
print(result)
What will be the output of the following code?
my_tuple = ('apple', 'banana', 'cherry')
new_tuple = my_tuple + ('orange',)
print(new_tuple)
What will be the output of the following code?
my_set = {1, 2, 3, 4, 5}
new_set = {x**2 for x in my_set}
print(new_set)
What will be the output of the following code?
my_dict = {'name': 'John', 'age': 25, 'city': 'New York'}
my_dict.clear()
print(my_dict)