Thursday, August 1, 2024

📑 In Progress

📑 Task

1)
2)

📑 Answer

1)
2)

Sunday, July 14, 2024

📑 Rounding

📑 Task

1) What will be the result of running the code?
2) What symbol should be removed so that
the second number in the resulting list becomes 2 less?

📑 Answer

1) [28.0, 66.0]
2) '1' should be removed

Saturday, June 22, 2024

📑 Global Variables in Lambda Functions

📑 Task

1) What object does this specific function modify and
what will the code print when the mini program runs?
2) Change this code snippet so that: a) the function can be used to generate Fibonacci sequences
independently, without relying on a global state
b) it returns only the n-st number of the sequence

📑 Answer

1) The function changes the global variable with
the initial value "empty list" by iterative appending
The result of the launch is a printout of a list
(the first ten numbers of the Fibonacci series)
2)

Thursday, June 13, 2024

📑 Custom Dictionaries

📑 Task

1) Describe the properties of the created custom dictionary
2) Define another dictionary in a similar way but with other properties
Your dictionary can have a list as a value only where it's necessary
That is, only where several values correspond to one key
in the definding process

📑 Answer

1) - **Key-Value Mapping**:
The dictionary maps integer keys to their corresponding binary string
representation, padded with leading zeros to a fixed length of 16 bits.
- **Automatic Conversion**:
When setting a new key-value pair using the `__setitem__` method,
the integer key is automatically converted to its binary string
representation before being stored in the dictionary.
- **Inheritance**:
By inheriting from `UserDict`, the `IntBinDict` class inherits
all the methods and properties of the built-in `dict` type,
allowing for seamless integration with existing Python code
that expects a dictionary-like object.
2)

Tuesday, June 4, 2024

📑 Items not Defined in the Dictionary

📑 Task

1) What element removing is fundamentally different from
all others for dictionary in this code fragment?
2) Suggest programs to access elements that do not exist
in the dictionary without causing an error

📑 Answer

1) Deleting "11" is different from all others, since such a key
was not defined in the dictionary
2)

Friday, May 31, 2024

📑 Pairs in Strings

📑 Task

1) What does this program calculate?
2) Suggest a program for easier calculation of this indicator

📑 Answer

1) This program calculates the maximum number of pairs of the same letters
in a given string, taking into account all possible shifts of the string.
2)

Monday, May 27, 2024

📑 Coroutine Math Functions

📑 Task

1) What is the name of the special type of functions
(the second one in the given code fragment)?
Why do we add "None" to the beginning of the list of angle measurements?
2) Modify this function so that it collects values and does not print them out

📑 Answer

1) This is a coroutine function
We must initialize the coroutine and prepare it to accept values
so we are starting with None
2)