WEAKLY PYTHON MILLIONAIRE DIGEST 3.10-9.10.2022
~ Topic #5 βMethodsβ
~ Average accuracy 50%
~ Average involvement 30 people (11%)
N.B.
πPay attention to the way the split() method creates the list - the initial element type remains (e.g. (β1,2β.split(β,β) returns [β1β, β2β], not [1, 2])
πNote the logic of methods layering: some methods will return the AttributeError (e.g. βX yβ.split().lower() will not work, as the lower() method is used with a string, and here split() has already created a list)
~ Topic #5 βMethodsβ
~ Average accuracy 50%
~ Average involvement 30 people (11%)
N.B.
πPay attention to the way the split() method creates the list - the initial element type remains (e.g. (β1,2β.split(β,β) returns [β1β, β2β], not [1, 2])
πNote the logic of methods layering: some methods will return the AttributeError (e.g. βX yβ.split().lower() will not work, as the lower() method is used with a string, and here split() has already created a list)
74. What will be printed when the following code is executed?
Anonymous Quiz
6%
Rob Susan Alex Jenny Petty Patrick Ann John
10%
Error
29%
Alex, Patrick, Jenny, Ann, Rob, Petty, Susan, John
55%
Ann, Susan, Petty, John, Rob, Patrick, Susan, Jenny, Alex
75. What will be printed when the following code is executed?
Anonymous Quiz
9%
3
41%
three
45%
['three']
5%
one
76. What will be printed when the following code is executed?
Anonymous Quiz
44%
{'h': 1, 'e': 1, 'l': 2, 'o': 1}
34%
{'h': 0, 'e': 1, 'l': 2, 'l': 3, 'o': 4}
4%
{'h': 0, 'e': 1, 'l': 2, 'o': 3}
18%
SyntaxError
77. What will be printed when the following code is executed?
Anonymous Quiz
22%
TypeError
23%
{2: 'two', 123: ['one', 'two', 'three']} ; {1: 'one', 2: 'two', 123: ['two', 'three']}
22%
{2: 'two', 123: ['two', 'three']} ; {1: 'one', 2: 'two', 123: ['one', 'two', 'three']}
32%
{2: 'two', 123: ['two', 'three']} ; {1: 'one', 2: 'two', 123: ['two', 'three']}
78. What will be printed when the following code is executed?
Anonymous Quiz
35%
['coding', 'is', 'so', 'fun']
20%
False
37%
True
7%
error
79. What will be printed when the following code is executed?
Anonymous Quiz
13%
['pears', 'apples']
18%
200
58%
300
11%
[200, 100]
80. What will be printed when the following code is executed?
Anonymous Quiz
28%
error
41%
['cucumbers', 'bananas', 'lemons', 'pineapples']
8%
[400, 333, 98, 45]
23%
{'bananas': 333, 'pineapples': 45, 'lemons': 98, 'cucumbers': 400}
WEAKLY PYTHON MILLIONAIRE DIGEST 10.10-16.10.2022
~ Topic #6 βUnordered data typesβ
~ Average accuracy 41%
~ Average involvement 45 people (16%)
N.B.
π The set() function will return a set of elements in a random order without duplicates
πPay attention to the type of the element that is required in the result (e.g. many people choose the correct result, but in numbers instead of strings)
π If you change the list, the link to which is part of some dictionary, the dictionary itself will change (e.g. l = [1], dict = {a:l} or {a:[1]}, then we change l = [2], so now dict = {a:[2]})
~ Topic #6 βUnordered data typesβ
~ Average accuracy 41%
~ Average involvement 45 people (16%)
N.B.
π The set() function will return a set of elements in a random order without duplicates
πPay attention to the type of the element that is required in the result (e.g. many people choose the correct result, but in numbers instead of strings)
π If you change the list, the link to which is part of some dictionary, the dictionary itself will change (e.g. l = [1], dict = {a:l} or {a:[1]}, then we change l = [2], so now dict = {a:[2]})
81. What will be printed when the following code is executed?
Anonymous Quiz
41%
['Hawkeye', 'Thor', 'Falcon'], ['Iron Man', 'Captain America', 'Black Widow', 'The Hulk']
32%
['Hawkeye', 'Thor', 'Falcon'] ['Iron Man', 'Captain America', 'Black Widow', 'The Hulk']
24%
SyntaxError
3%
infinite loop
82. What will be printed when the following code is executed?
Anonymous Quiz
35%
['Hawkeye', 'Thor', 'Falcon'], ['Iron Man', 'Captain America', 'Black Widow', 'The Hulk']
47%
['Hawkeye', 'Thor', 'Falcon'] ['Iron Man', 'Captain America', 'Black Widow', 'The Hulk']
17%
SyntaxError
1%
infinite loop