Font size
Worksheetskaran kishore
Total questions: 8
Worksheet time: 4mins
x = ['ab','cd']
print(list(map(list, x)))
[ [‘a’, ‘b’], [‘c’, ‘d’]
['ab','cd']
[[‘a’,’c’],[‘b’,’d’]]
[ [‘a’, ‘d’], [‘b’, ‘c’]]
Find the most frequent value in a list
test = [1, 2, 3, 9, 2, 7, 3, 5, 9, 9, 9]
print(max(set(test), key = test._____))
split
sizeof
count
random
A while is the what type of iteration?
definite
indefinite
indeterminate
discrimnent
What will be the output of the following program?
L=['python','c++','java','c#']
for language in range(Len(L)):
print (language)
Python, C++, Java, c#
0, 1, 2, 3
0, 1, 2, 3, 4
Python, C++, Java
What is the correct way to initialize a dictionary?
D = {a-10, b-20, c-30}
D = {‘a’-10, ‘b’-20, ‘c’-30}
D = {a:10, b:20, c:30}
D = {‘a’:10, ‘b’:20, ‘c’:30}
Python invented by
(a)
Which error is encountered while accessing a position that is not present in a list?
KeyError
IndexError
ValueError
RuntimeError
Why do we use functions?
To improve readability.
To reuse code blocks.
For the ease of code debugging.
All the above.
