{"id":454164,"date":"2025-04-01T16:47:20","date_gmt":"2025-04-01T16:47:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=454164"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=454164","title":{"rendered":"<span>30 \u0442\u0440\u044e\u043a\u043e\u0432 \u043d\u0430 Python \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0447\u0435\u0442, \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u044b! \u041d\u0430\u0448\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0435\u0439 \u043d\u0430 <code>python<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u0430\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c <a href=\"https:\/\/t.me\/datafeeling\">\u0443 \u043c\u0435\u043d\u044f<\/a> \u0432 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430\u0445, \u0438 \u0432\u043e\u0442 \u0434\u0435\u043b\u044e\u0441\u044c! \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 100 \u043f\u0443\u043d\u043a\u0442\u043e\u0432. \u041f\u043e\u0435\u0445\u0430\u043b\u0438! <\/p>\n<p><strong>1. \u0421\u043f\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (List Comprehensions)<\/strong><\/p>\n<pre><code class=\"python\">squares = [x**2 for x in range(10)] print(squares)  # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041a\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c \u0438 \u043b\u0435\u0433\u043a\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u043c, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>2. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/strong><\/p>\n<pre><code class=\"python\">def generate_numbers(n):     for i in range(n):         yield i * 2  gen = generate_numbers(5) print(list(gen))  # [0, 2, 4, 6, 8]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043f\u0430\u043c\u044f\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><strong>3. \u0424\u0443\u043d\u043a\u0446\u0438\u044f enumerate()<\/strong><\/p>\n<pre><code class=\"python\">fruits = ['apple', 'banana', 'cherry'] for index, fruit in enumerate(fruits):     print(index, fruit) # 0 apple # 1 banana # 2 cherry<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u043c.<\/p>\n<p><strong>4. \u0424\u0443\u043d\u043a\u0446\u0438\u044f zip()<\/strong><\/p>\n<pre><code class=\"python\">names = ['Alice', 'Bob', 'Charlie'] ages = [25, 30, 35] combined = list(zip(names, ages)) print(combined)  # [('Alice', 25), ('Bob', 30), ('Charlie', 35)]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>5. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 *args \u0438 **kwargs<\/strong><\/p>\n<pre><code class=\"python\">def example_function(*args, **kwargs):     print(\"args:\", args)     print(\"kwargs:\", kwargs)  example_function(1, 2, 3, name=\"Alice\", age=25) # args: (1, 2, 3) # kwargs: {'name': 'Alice', 'age': 25}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p><strong>6. \u0421\u043b\u043e\u0432\u0430\u0440\u0438 \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c (Dictionary Comprehensions)<\/strong><\/p>\n<pre><code class=\"python\">squares_dict = {x: x**2 for x in range(5)} print(squares_dict)  # {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0431\u043e\u043b\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u043e, \u0447\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0446\u0438\u043a\u043b\u043e\u0432.<\/p>\n<p><strong>7. \u0424\u0443\u043d\u043a\u0446\u0438\u044f map()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4] squared = list(map(lambda x: x**2, numbers)) print(squared)  # [1, 4, 9, 16]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u044b.<\/p>\n<p><strong>8. \u0424\u0443\u043d\u043a\u0446\u0438\u044f filter()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4, 5] even_numbers = list(filter(lambda x: x % 2 == 0, numbers)) print(even_numbers)  # [2, 4]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.<\/p>\n<p><strong>9. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 set() \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 2, 3, 4, 4, 5] unique_numbers = set(numbers) print(unique_numbers)  # {1, 2, 3, 4, 5}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0411\u044b\u0441\u0442\u0440\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p><strong>10. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sorted()<\/strong><\/p>\n<pre><code class=\"python\">unsorted_list = [5, 2, 3, 1, 4] sorted_list = sorted(unsorted_list) print(sorted_list)  # [1, 2, 3, 4, 5]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c.<\/p>\n<p><strong>11. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 defaultdict \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f collections<\/strong><\/p>\n<pre><code class=\"python\">from collections import defaultdict  dd = defaultdict(int) dd['apple'] += 1 dd['banana'] += 2 print(dd)  # defaultdict(&lt;class 'int'&gt;, {'apple': 1, 'banana': 2})<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u043c\u0438.<\/p>\n<p><strong>12. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Counter \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f collections<\/strong><\/p>\n<pre><code class=\"python\">from collections import Counter  fruits = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana'] count = Counter(fruits) print(count)  # Counter({'banana': 3, 'apple': 2, 'orange': 1})<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0447\u0430\u0441\u0442\u043e\u0442\u044b.<\/p>\n<p><strong>13. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 itertools \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">import itertools  count = itertools.count(start=5, step=2) print(next(count))  # 5 print(next(count))  # 7<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>14. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 with \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">with open('example.txt', 'w') as f:     f.write('Hello, World!') # \u0424\u0430\u0439\u043b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 with<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<p><strong>15. \u0424\u0443\u043d\u043a\u0446\u0438\u044f any() \u0438 all()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4] print(any(x &gt; 3 for x in numbers))  # True print(all(x &gt; 0 for x in numbers))  # True<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>16. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 lambda \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong><\/p>\n<pre><code class=\"python\">add = lambda x, y: x + y print(add(5, 3))  # 8<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0447\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p><strong>17. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 try \u0438 except \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439<\/strong><\/p>\n<pre><code class=\"python\">try:     result = 10 \/ 0 except ZeroDivisionError:     print(\"\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u043b\u044c!\")<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>18. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 f-\u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/strong><\/p>\n<pre><code class=\"python\">name = \"Alice\" age = 30 print(f\"{name} is {age} years old.\")  # Alice is 30 years old.<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<\/p>\n<p><strong>19. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 re \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import re  text = \"The rain in Spain\" match = re.search(r'\\bS\\w+', text) print(match.group())  # Spain<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0449\u043d\u044b\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>20. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 json \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import json  data = {'name': 'Alice', 'age': 30} json_data = json.dumps(data) print(json_data)  # {\"name\": \"Alice\", \"age\": 30}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API.<\/p>\n<p><strong>21. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 datetime \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c<\/strong><\/p>\n<pre><code class=\"python\">from datetime import datetime  now = datetime.now() print(now)  # \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f<\/code><\/pre>\n<p><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>: \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c.<\/p>\n<p><strong>22. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 os \u0438 sys \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439<\/strong><\/p>\n<pre><code class=\"python\">import os  current_directory = os.getcwd() print(current_directory)  # \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>23. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 pickle \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">import pickle  data = {'name': 'Alice', 'age': 30} with open('data.pkl', 'wb') as f:     pickle.dump(data, f)  with open('data.pkl', 'rb') as f:     loaded_data = pickle.load(f) print(loaded_data)  # {'name': 'Alice', 'age': 30}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>24. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 @staticmethod \u0438 @classmethod<\/strong><\/p>\n<pre><code class=\"python\">class MyClass:     @staticmethod     def static_method():         return \"This is a static method.\"      @classmethod     def class_method(cls):         return f\"This is a class method of {cls.__name__}.\"  print(MyClass.static_method())  # This is a static method. print(MyClass.class_method())    # This is a class method of MyClass.<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p><strong>25. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 property() \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/strong><\/p>\n<pre><code class=\"python\">class Person:     def __init__(self, name):         self._name = name      @property     def name(self):         return self._name  person = Person(\"Alice\") print(person.name)  # Alice<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e.<\/p>\n<p><strong>26. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 assert \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438<\/strong><\/p>\n<pre><code class=\"python\">x = 5 assert x &gt; 0, \"x \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\"  # \u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0442\u043b\u0430\u0434\u043a\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p><strong>27. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 timeit \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430<\/strong><\/p>\n<pre><code class=\"python\">import timeit  execution_time = timeit.timeit('sum(range(100))', number=10000) print(execution_time)  # \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043f\u043e\u043c\u043e\u0433\u0430\u044f \u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>28. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 functools.lru_cache \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">from functools import lru_cache  @lru_cache(maxsize=None) def fibonacci(n):     if n &lt; 2:         return n     return fibonacci(n-1) + fibonacci(n-2)  print(fibonacci(10))  # 55<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p><strong>29. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 contextlib \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0445 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">from contextlib import contextmanager  @contextmanager def my_context():     print(\"Entering the context\")     yield     print(\"Exiting the context\")  with my_context():     print(\"Inside the context\") # Entering the context # Inside the context # Exiting the context<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/p>\n<p><strong>30. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 numpy \u0438 pandas \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import numpy as np import pandas as pd  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 numpy array = np.array([1, 2, 3, 4]) print(array * 2)  # [2 4 6 8]  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 pandas data = {'Name': ['Alice', 'Bob'], 'Age': [30, 25]} df = pd.DataFrame(data) print(df) #    Name  Age # 0  Alice   30 # 1    Bob   25<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043e\u0431\u044a\u0435\u043c\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u043e <a href=\"https:\/\/t.me\/datafeeling\/903\">pandas \u0438 numpy<\/a> \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0430\u043c\u0438 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c. \u041f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c <a href=\"https:\/\/t.me\/datafeeling\/361\">\u043f\u0440\u043e \u0442\u0438\u043f\u044b<\/a>. \u041e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b! <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <\/h2>\n<p>\u041d\u0430 python \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u044e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u043a\u043e\u0434 \u0438 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u044f\u0437\u044b\u043a\u0435. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u043b\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u0434\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u0442\u044c! <a href=\"https:\/\/t.me\/datafeeling\">\u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430 \u0441\u0432\u044f\u0437\u0438<\/a>! \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0435\u0441\u044c <code>data science<\/code>, \u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u0432\u0430\u0441! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0437\u0430\u043a\u0438\u043d\u0443 \u0432 \u043a\u0430\u043d\u0430\u043b! <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 <a href=\"https:\/\/t.me\/datafeeling\/1192\">\u0444\u0440\u0438\u043b\u0430\u043d\u0441 \u0437\u0430\u043a\u0430\u0437\u044b \u043d\u0430 python<\/a>! <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/870920\/\"> https:\/\/habr.com\/ru\/articles\/870920\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0447\u0435\u0442, \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u044b! \u041d\u0430\u0448\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0435\u0439 \u043d\u0430 <code>python<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u0430\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c <a href=\"https:\/\/t.me\/datafeeling\">\u0443 \u043c\u0435\u043d\u044f<\/a> \u0432 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430\u0445, \u0438 \u0432\u043e\u0442 \u0434\u0435\u043b\u044e\u0441\u044c! \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 100 \u043f\u0443\u043d\u043a\u0442\u043e\u0432. \u041f\u043e\u0435\u0445\u0430\u043b\u0438! <\/p>\n<p><strong>1. \u0421\u043f\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (List Comprehensions)<\/strong><\/p>\n<pre><code class=\"python\">squares = [x**2 for x in range(10)] print(squares)  # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041a\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c \u0438 \u043b\u0435\u0433\u043a\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u043c, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>2. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/strong><\/p>\n<pre><code class=\"python\">def generate_numbers(n):     for i in range(n):         yield i * 2  gen = generate_numbers(5) print(list(gen))  # [0, 2, 4, 6, 8]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u044f\u0442 \u043f\u0430\u043c\u044f\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><strong>3. \u0424\u0443\u043d\u043a\u0446\u0438\u044f enumerate()<\/strong><\/p>\n<pre><code class=\"python\">fruits = ['apple', 'banana', 'cherry'] for index, fruit in enumerate(fruits):     print(index, fruit) # 0 apple # 1 banana # 2 cherry<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u043c.<\/p>\n<p><strong>4. \u0424\u0443\u043d\u043a\u0446\u0438\u044f zip()<\/strong><\/p>\n<pre><code class=\"python\">names = ['Alice', 'Bob', 'Charlie'] ages = [25, 30, 35] combined = list(zip(names, ages)) print(combined)  # [('Alice', 25), ('Bob', 30), ('Charlie', 35)]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>5. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 *args \u0438 **kwargs<\/strong><\/p>\n<pre><code class=\"python\">def example_function(*args, **kwargs):     print(\"args:\", args)     print(\"kwargs:\", kwargs)  example_function(1, 2, 3, name=\"Alice\", age=25) # args: (1, 2, 3) # kwargs: {'name': 'Alice', 'age': 25}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p><strong>6. \u0421\u043b\u043e\u0432\u0430\u0440\u0438 \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c (Dictionary Comprehensions)<\/strong><\/p>\n<pre><code class=\"python\">squares_dict = {x: x**2 for x in range(5)} print(squares_dict)  # {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0431\u043e\u043b\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u043e, \u0447\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0446\u0438\u043a\u043b\u043e\u0432.<\/p>\n<p><strong>7. \u0424\u0443\u043d\u043a\u0446\u0438\u044f map()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4] squared = list(map(lambda x: x**2, numbers)) print(squared)  # [1, 4, 9, 16]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u044b.<\/p>\n<p><strong>8. \u0424\u0443\u043d\u043a\u0446\u0438\u044f filter()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4, 5] even_numbers = list(filter(lambda x: x % 2 == 0, numbers)) print(even_numbers)  # [2, 4]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.<\/p>\n<p><strong>9. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 set() \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 2, 3, 4, 4, 5] unique_numbers = set(numbers) print(unique_numbers)  # {1, 2, 3, 4, 5}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0411\u044b\u0441\u0442\u0440\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p><strong>10. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sorted()<\/strong><\/p>\n<pre><code class=\"python\">unsorted_list = [5, 2, 3, 1, 4] sorted_list = sorted(unsorted_list) print(sorted_list)  # [1, 2, 3, 4, 5]<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c.<\/p>\n<p><strong>11. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 defaultdict \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f collections<\/strong><\/p>\n<pre><code class=\"python\">from collections import defaultdict  dd = defaultdict(int) dd['apple'] += 1 dd['banana'] += 2 print(dd)  # defaultdict(&lt;class 'int'&gt;, {'apple': 1, 'banana': 2})<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u043c\u0438.<\/p>\n<p><strong>12. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Counter \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f collections<\/strong><\/p>\n<pre><code class=\"python\">from collections import Counter  fruits = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana'] count = Counter(fruits) print(count)  # Counter({'banana': 3, 'apple': 2, 'orange': 1})<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0447\u0430\u0441\u0442\u043e\u0442\u044b.<\/p>\n<p><strong>13. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 itertools \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">import itertools  count = itertools.count(start=5, step=2) print(next(count))  # 5 print(next(count))  # 7<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>14. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 with \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">with open('example.txt', 'w') as f:     f.write('Hello, World!') # \u0424\u0430\u0439\u043b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 with<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<p><strong>15. \u0424\u0443\u043d\u043a\u0446\u0438\u044f any() \u0438 all()<\/strong><\/p>\n<pre><code class=\"python\">numbers = [1, 2, 3, 4] print(any(x &gt; 3 for x in numbers))  # True print(all(x &gt; 0 for x in numbers))  # True<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>16. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 lambda \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong><\/p>\n<pre><code class=\"python\">add = lambda x, y: x + y print(add(5, 3))  # 8<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0447\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p><strong>17. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 try \u0438 except \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439<\/strong><\/p>\n<pre><code class=\"python\">try:     result = 10 \/ 0 except ZeroDivisionError:     print(\"\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u043b\u044c!\")<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>18. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 f-\u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/strong><\/p>\n<pre><code class=\"python\">name = \"Alice\" age = 30 print(f\"{name} is {age} years old.\")  # Alice is 30 years old.<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<\/p>\n<p><strong>19. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 re \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import re  text = \"The rain in Spain\" match = re.search(r'\\bS\\w+', text) print(match.group())  # Spain<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0449\u043d\u044b\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>20. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 json \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import json  data = {'name': 'Alice', 'age': 30} json_data = json.dumps(data) print(json_data)  # {\"name\": \"Alice\", \"age\": 30}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API.<\/p>\n<p><strong>21. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 datetime \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c<\/strong><\/p>\n<pre><code class=\"python\">from datetime import datetime  now = datetime.now() print(now)  # \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f<\/code><\/pre>\n<p><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>: \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c.<\/p>\n<p><strong>22. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 os \u0438 sys \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439<\/strong><\/p>\n<pre><code class=\"python\">import os  current_directory = os.getcwd() print(current_directory)  # \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>23. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 pickle \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">import pickle  data = {'name': 'Alice', 'age': 30} with open('data.pkl', 'wb') as f:     pickle.dump(data, f)  with open('data.pkl', 'rb') as f:     loaded_data = pickle.load(f) print(loaded_data)  # {'name': 'Alice', 'age': 30}<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>24. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 @staticmethod \u0438 @classmethod<\/strong><\/p>\n<pre><code class=\"python\">class MyClass:     @staticmethod     def static_method():         return \"This is a static method.\"      @classmethod     def class_method(cls):         return f\"This is a class method of {cls.__name__}.\"  print(MyClass.static_method())  # This is a static method. print(MyClass.class_method())    # This is a class method of MyClass.<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p><strong>25. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 property() \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/strong><\/p>\n<pre><code class=\"python\">class Person:     def __init__(self, name):         self._name = name      @property     def name(self):         return self._name  person = Person(\"Alice\") print(person.name)  # Alice<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e.<\/p>\n<p><strong>26. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 assert \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438<\/strong><\/p>\n<pre><code class=\"python\">x = 5 assert x &gt; 0, \"x \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\"  # \u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0442\u043b\u0430\u0434\u043a\u0443, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p><strong>27. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 timeit \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430<\/strong><\/p>\n<pre><code class=\"python\">import timeit  execution_time = timeit.timeit('sum(range(100))', number=10000) print(execution_time)  # \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043f\u043e\u043c\u043e\u0433\u0430\u044f \u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p><strong>28. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 functools.lru_cache \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">from functools import lru_cache  @lru_cache(maxsize=None) def fibonacci(n):     if n &lt; 2:         return n     return fibonacci(n-1) + fibonacci(n-2)  print(fibonacci(10))  # 55<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u0423\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p><strong>29. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 contextlib \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0445 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432<\/strong><\/p>\n<pre><code class=\"python\">from contextlib import contextmanager  @contextmanager def my_context():     print(\"Entering the context\")     yield     print(\"Exiting the context\")  with my_context():     print(\"Inside the context\") # Entering the context # Inside the context # Exiting the context<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/p>\n<p><strong>30. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 numpy \u0438 pandas \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/strong><\/p>\n<pre><code class=\"python\">import numpy as np import pandas as pd  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 numpy array = np.array([1, 2, 3, 4]) print(array * 2)  # [2 4 6 8]  # \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 pandas data = {'Name': ['Alice', 'Bob'], 'Age': [30, 25]} df = pd.DataFrame(data) print(df) #    Name  Age # 0  Alice   30 # 1    Bob   25<\/code><\/pre>\n<p><strong><em>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/em>:<\/strong> \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043e\u0431\u044a\u0435\u043c\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u043e <a href=\"https:\/\/t.me\/datafeeling\/903\">pandas \u0438 numpy<\/a> \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0430\u043c\u0438 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c. \u041f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c <a href=\"https:\/\/t.me\/datafeeling\/361\">\u043f\u0440\u043e \u0442\u0438\u043f\u044b<\/a>. \u041e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b! <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <\/h2>\n<p>\u041d\u0430 python \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u044e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u043a\u043e\u0434 \u0438 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u044f\u0437\u044b\u043a\u0435. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u043b\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u0434\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u0442\u044c! <a href=\"https:\/\/t.me\/datafeeling\">\u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430 \u0441\u0432\u044f\u0437\u0438<\/a>! \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0435\u0441\u044c <code>data science<\/code>, \u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u0432\u0430\u0441! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0437\u0430\u043a\u0438\u043d\u0443 \u0432 \u043a\u0430\u043d\u0430\u043b! <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 <a href=\"https:\/\/t.me\/datafeeling\/1192\">\u0444\u0440\u0438\u043b\u0430\u043d\u0441 \u0437\u0430\u043a\u0430\u0437\u044b \u043d\u0430 python<\/a>! <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/870920\/\"> https:\/\/habr.com\/ru\/articles\/870920\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-454164","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=454164"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454164\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}