>>> a=dict()
>>> a[1]Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
85
Questions
3/5
Page
Pick an option on a question to see the right answer and solution.
>>> a=dict()
>>> a[1]Select an option to see the answer and solution.
a={1:"A",2:"B",3:"C"}
a.setdefault(4,"D")
print(a)Select an option to see the answer and solution.
a={1:5,2:3,3:4}
print(a.pop(4,9))Select an option to see the answer and solution.
>>> import collections
>>> a=collections.Counter([3,3,4,5])
>>> b=collections.Counter([3,4,4,5,5,5])
>>> a&bSelect an option to see the answer and solution.
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 > d2Select an option to see the answer and solution.
>>>import collections
>>> b=collections.Counter([2,2,3,4,4,4])
>>> b.most_common(1)Select an option to see the answer and solution.
Select an option to see the answer and solution.
class demo(dict):
def __test__(self,key):
return []
a = demo()
a['test'] = 7
print(a)Select an option to see the answer and solution.
a={}
a[2]=1
a[1]=[2,3,4]
print(a[1][1])Select an option to see the answer and solution.
>>> import collections
>>> a=dict()
>>> a=collections.defaultdict(str)
>>> a['A']Select an option to see the answer and solution.
count={}
count[(1,2,4)] = 5
count[(4,2,1)] = 7
count[(1,2)] = 6
count[(4,2,1)] = 2
tot = 0
for i in count:
tot=tot+count[i]
print(len(count)+tot)Select an option to see the answer and solution.
a={1:"A",2:"B",3:"C"}
for i in a:
print(i,end=" ")Select an option to see the answer and solution.
Select an option to see the answer and solution.
a={1:"A",2:"B",3:"C"}
b=a.copy()
b[2]="D"
print(a)Select an option to see the answer and solution.
a={1:5,2:3,3:4}
a.pop(3)
print(a)Select an option to see the answer and solution.
a={1:"A",2:"B",3:"C"}
b={4:"D",5:"E"}
a.update(b)
print(a)Select an option to see the answer and solution.
>>>import collections
>>> a=collections.Counter([1,1,2,3,3,4,4,4])
>>> aSelect an option to see the answer and solution.
Select an option to see the answer and solution.
>>> a={1:"A",2:"B",3:"C"}
>>> del aSelect an option to see the answer and solution.
a={1:"A",2:"B",3:"C"}
a.clear()
print(a)Select an option to see the answer and solution.