99. What will be printed when the following code is executed?
Anonymous Quiz
36%
KeyError
54%
['December', 'February', 'January']
9%
['summer', 'winter']
1%
['August', 'July', 'June']
100. What will be printed when the following code is executed?
Anonymous Quiz
19%
KeyError
65%
['December', 'February', 'January']
5%
['summer', 'winter']
11%
['August', 'July', 'June']
101. What will be printed when the following code is executed?
Anonymous Quiz
63%
['d', 'e', 'r']
22%
['1', 'c', 'k', 'o', 's', 's']
5%
[0,0,0,1]
11%
['-', 'h', 'i', 'r', 's', 't', 't']
WEAKLY PYTHON MILLIONAIRE DIGEST 31.10-6.11.2022
~ Topic #9 “Nested data structures. Sorting”
~ Average accuracy 54%
~ Average involvement 29 people (10%)
N.B.
🐍 Remember the general rules of sorting: numbers are sorted in either ascending or descending order (according to the attribute specified); strings are sorted in alphabetical order, latin letters first, then cyrillic; first uppercase, then lowercase. Numbers in form of a string are sorted according to their codes (e.g. 11 comes after 2 when being sorted in ascending order, but “11” comes before “2”, while sorting as string type)
🐍 Be careful when referring to the keys in the dictionary. Square brackets in the dictionary call a specific element that is already in the dictionary, not an element by its index. For example, if we want to access the first element in a = {1:”one”, 2:”two”} by typing a[0], KeyError will occur: we tried to access a “0” key in a dictionary that doesn’t contain it
~ Topic #9 “Nested data structures. Sorting”
~ Average accuracy 54%
~ Average involvement 29 people (10%)
N.B.
🐍 Remember the general rules of sorting: numbers are sorted in either ascending or descending order (according to the attribute specified); strings are sorted in alphabetical order, latin letters first, then cyrillic; first uppercase, then lowercase. Numbers in form of a string are sorted according to their codes (e.g. 11 comes after 2 when being sorted in ascending order, but “11” comes before “2”, while sorting as string type)
🐍 Be careful when referring to the keys in the dictionary. Square brackets in the dictionary call a specific element that is already in the dictionary, not an element by its index. For example, if we want to access the first element in a = {1:”one”, 2:”two”} by typing a[0], KeyError will occur: we tried to access a “0” key in a dictionary that doesn’t contain it
102. What will be printed when the following code is executed?
Anonymous Quiz
17%
Error
48%
True
34%
False
1%
"false"
103. What will be printed when the following code is executed?
Anonymous Quiz
31%
NameError
20%
42
20%
55
30%
infinite loop
104. What will be printed when the following code is executed?
Anonymous Quiz
19%
5
67%
5.0
10%
4.75
3%
4.5
105. What will be printed when the following code is executed?
Anonymous Quiz
38%
error
17%
[“11”, “44”, “99”]
6%
[1, 2, 3]
38%
[1, 16, 81]
106. What will be printed when the following code is executed?
Anonymous Quiz
5%
3
52%
[“hehe”]
24%
“hehe”
19%
“hello”
107. What will be printed when the following code is executed?
Anonymous Quiz
57%
['ztuebs', 'jkyfmo', 'dhkpq']
13%
['70:ztuebs', '0:jkyfmo', '54:dhkpq']
7%
['54:dhkpq']
23%
['dhkpq', 'jkyfmo', 'ztuebs']
108. What will be printed when the following code is executed?
Anonymous Quiz
10%
['70:ztuebs', '0:jkyfmo', '54:dhkpq']
62%
{70: 'ztuebs', 0: 'jkyfmo', 54: 'dhkpq'}
27%
{54: 'jkyfmo'}
2%
{'54:dhkpq'}
WEAKLY PYTHON MILLIONAIRE DIGEST 7.11-13.11.2022
~ Topic #10 “Functions”
~ Average accuracy 45%
~ Average involvement 14 people (5%)
N.B.
🐍 * and ** in the function definition are the unpacking operators
🐍 *args (Non-Keyword Arguments) allows you take in more arguments than the number of formal arguments that you previously defined (e.g. a multiply function that takes any number of arguments and is able to multiply them all together)
🐍 **kwargs (Keyword Arguments) is used to pass a keyworded argument list where you provide a name to the variable as you pass it into the function, the same way a dictionary maps each keyword to the value that we pass alongside it
🐍 It is possible to use the functions you created in the code text of another function’s definition
~ Topic #10 “Functions”
~ Average accuracy 45%
~ Average involvement 14 people (5%)
N.B.
🐍 * and ** in the function definition are the unpacking operators
🐍 *args (Non-Keyword Arguments) allows you take in more arguments than the number of formal arguments that you previously defined (e.g. a multiply function that takes any number of arguments and is able to multiply them all together)
🐍 **kwargs (Keyword Arguments) is used to pass a keyworded argument list where you provide a name to the variable as you pass it into the function, the same way a dictionary maps each keyword to the value that we pass alongside it
🐍 It is possible to use the functions you created in the code text of another function’s definition