Question: 1. What will the following code display? dct = {'Monday':1, 'Tuesday':2, 'Wednesday':3} print(dct.get('Tuesday', 'Not Found')) 2. dict1 = {'1:'a',2:'b',3:'c',4:'d'} Write a single Python command to
1.
What will the following code display?
dct = {'Monday':1, 'Tuesday':2, 'Wednesday':3}
print(dct.get('Tuesday', 'Not Found'))
2.
dict1 = {'1:'a',2:'b',3:'c',4:'d'}
Write a single Python command to remove all the entries in the above dictionary.
3.
After the following code executes, what elements will be members of set3?
set1 = set([1, 2, 3])
set2 = set([2, 3, 4])
set3 = set1.symmetric_difference(set2)
4.
After the following code executes, what elements will be members of set3?
set1 = set(['o', 'p', 's', 'v'])
set2 = set(['a', 'p', 'r', 's'])
set3 = set1.intersection(set2)
5.
What will the following code display?
numbers = [1,2,3,4,5,6,7,8,9]
print(numbers[-4:])
6.
What does the following code display?
values = [2] * 5
print(values)
7.
What does the following code display?
myStr = 'yes'
myStr += 'no'
myStr += 'yes'
print (myStr)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
