Select an option to see the answer and solution.
MCQs on Python Tuples: Exam
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
60
Questions
3/3
Page
Pick an option on a question to see the right answer and solution.
>>> a=(0,1,2,3,4)
>>> b=slice(0,2)
>>> a[b]Select an option to see the answer and solution.
>>> a,b,c=1,2,3
>>> a,b,cSelect an option to see the answer and solution.
>>>t = (1, 2)
>>>2 * tSelect an option to see the answer and solution.
>>> a,b=6,7
>>> a,b=b,a
>>> a,bSelect an option to see the answer and solution.
Select an option to see the answer and solution.
numberGames = {}
numberGames[(1,2,4)] = 8
numberGames[(4,2,1)] = 10
numberGames[(1,2)] = 12
sum = 0
for k in numberGames:
sum += numberGames[k]
print(len(numberGames) + sum)Select an option to see the answer and solution.
d = {"john":40, "peter":45}
d["john"]Select an option to see the answer and solution.
>>> a=(2,3,4)
>>> sum(a,3)Select an option to see the answer and solution.
>>> a=(2,3,1,5)
>>> a.sort()
>>> aSelect an option to see the answer and solution.
a = ('check',)
n = 2
for i in range(int(n)):
a = (a,)
print(a)Select an option to see the answer and solution.
>>>my_tuple = (1, 2, 3, 4)
>>>my_tuple.append( (5, 6, 7) )
>>>print len(my_tuple)Select an option to see the answer and solution.
>>> a=(1,2,3,4)
>>> del(a[2])Select an option to see the answer and solution.
>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]Select an option to see the answer and solution.
>>> a,b=1,2,3Select an option to see the answer and solution.
>>> a=2,3,4,5
>>> aSelect an option to see the answer and solution.
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a<bSelect an option to see the answer and solution.
>>> a=(1,2,3)
>>> b=a.update(4,)Select an option to see the answer and solution.
>>>t=(1,2,4,3)
>>>t[1:3]Select an option to see the answer and solution.
>>> a=(1,2)
>>> b=(3,4)
>>> c=a+b
>>> cSelect an option to see the answer and solution.