Python Millionare
1.02K subscribers
477 photos
1 link
Small tasks, four answers
Download Telegram
120. What will be printed when the following code is executed?
Anonymous Quiz
17%
3307.5
67%
3307.549
15%
ValueError
0%
3307.55
121. What will be the last row of the table when the following code is executed?
Anonymous Quiz
9%
0 1254 Dentist USA 44
27%
1 1435 Actor Canada 27
30%
1 Actor Canada 27
34%
0 Dentist USA 44
WEAKLY PYTHON MILLIONAIRE DIGEST 21.11-27.11.2022

~ Topic #12 “Text files and tables”
~ Average accuracy 33%
~ Average involvement 12 people (4%)

N.B.

🐍Mind the file access modes while working with the files: ‘w’ - write only (open the file for writing, not reading), ‘w+’ - write and read (open the file for BOTH writing and reading), ‘r’ - read only (open file for reading, not writing), ‘r+’ - read and write (open the file for BOTH reading and writing), ‘a’ - append only (open file for writing (appending) only), ‘a+’ - append and read (open the file for BOTH reading and writing(appending))
🐍readlines() function reads all the lines and returns each of them as a string element in a list
122. What will be printed when the following code is executed?
Anonymous Quiz
16%
"55"
47%
11
24%
"56"
13%
10
123. What will be printed when the following code is executed?
Anonymous Quiz
13%
['Part 1', 'Part 2']
22%
AttributeError
47%
'Part 1'
18%
['Part 1']
124. What will be printed when the following code is executed?
Anonymous Quiz
8%
['Part 1', 'Part 2']
23%
AttributeError
42%
'Part 1'
28%
['Part 1']
127. What will be printed when the following code is executed?
Anonymous Quiz
44%
['b00k']
20%
['book']
20%
“War and Peace”
16%
“Anna Karenina”
128. What will be the last row of the output?
Anonymous Quiz
15%
error
27%
1 [Anna Karenina] [rus]
35%
2 [1984] [not_rus]
23%
0 [War and Peace] [rus]
WEAKLY PYTHON MILLIONAIRE DIGEST 28.11-04.12.2022

~ Topic #13 “Scraping: Collecting links from the website”
~ Average accuracy 35%
~ Average involvement 10 people (4%)

N.B.

🐍Method .contents returns the contents of the tag in a list format (e.g [‘something’])
🐍The .contents method cannot be used together with .find_all method - this way you are treating a list of elements like a single element. Use .find instead
🐍The .get() method is used to retrieve information from the given server using a given url. It is also used to get information about a certain class (e.g. if we have tag = <p class=“a”> Hello <\p>, then tag.get(“class”) gives [‘a’])