Python Millionare
1.02K subscribers
477 photos
1 link
Small tasks, four answers
Download Telegram
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
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”
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
109. What will be the last row of the created table when the following code is executed?
Anonymous Quiz
18%
0 95.94 95.89 891700
15%
open close volume
34%
ValueError will appear
33%
1 95.00 95.59 752500
110. What will the column named "index" contain when the following code is executed?
Anonymous Quiz
14%
1 2 1 2
41%
0 1 0 1
38%
0 1 2 3
7%
1 2 3 4