<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shaila B</title>
    <description>The latest articles on DEV Community by Shaila B (@shaila_b_tmk).</description>
    <link>https://dev.to/shaila_b_tmk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F373084%2Fc8194a83-6927-4522-a16e-adc91c497f64.jpg</url>
      <title>DEV Community: Shaila B</title>
      <link>https://dev.to/shaila_b_tmk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shaila_b_tmk"/>
    <language>en</language>
    <item>
      <title>Python zip_longest() Function.</title>
      <dc:creator>Shaila B</dc:creator>
      <pubDate>Fri, 30 Jul 2021 11:31:54 +0000</pubDate>
      <link>https://dev.to/shaila_b_tmk/python-ziplongest-function-4nfm</link>
      <guid>https://dev.to/shaila_b_tmk/python-ziplongest-function-4nfm</guid>
      <description>&lt;p&gt;Consider if we have two iterators of different lengths. then we iterate them together one iterator must end up with another iterator. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--38VTFZoE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643455382/VTzsrtsglD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--38VTFZoE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643455382/VTzsrtsglD.png" alt="carbon (9).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0K_ixl5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643505069/SqB1q8qOT.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0K_ixl5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643505069/SqB1q8qOT.png" alt="carbon (10).png"&gt;&lt;/a&gt;&lt;br&gt;
Here the elements 5 and 6 are missing. Because the zip() function will stop aggregating once the shortest iterable passed to it is exhausted.&lt;/p&gt;

&lt;p&gt;It will make more sense if we would return a group that containing elements 5 and 6 otherwise it will be problematic.&lt;/p&gt;

&lt;p&gt;In this situation, we can use zip_longest(). &lt;/p&gt;

&lt;p&gt;The python zip_longest() function can fill up the position of empty iterable with some user-defined values.&lt;/p&gt;

&lt;p&gt;If the user does not define the fillvalue parameter, the zip_longest() function fills None as the default value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t7HsEwiu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643653428/fIlFhhrZAu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t7HsEwiu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643653428/fIlFhhrZAu.png" alt="carbon (8).png"&gt;&lt;/a&gt;&lt;br&gt;
For Example :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OUp4hHIT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643698668/hJluqyeKN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OUp4hHIT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643698668/hJluqyeKN.png" alt="carbon (11).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Aas_lqA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643750503/Z6MUnQwgF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Aas_lqA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643750503/Z6MUnQwgF.png" alt="carbon (12).png"&gt;&lt;/a&gt;&lt;br&gt;
In the above example, we imported zip_longest() function from itertools library.&lt;/p&gt;

&lt;p&gt;We can observe in the above example those list y elements are filled with no value. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0OzAcrN---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643807513/jwoNbkdRf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0OzAcrN---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643807513/jwoNbkdRf.png" alt="carbon (13).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QzvaVnaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643902216/7AywdMZEv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QzvaVnaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643902216/7AywdMZEv.png" alt="carbon (14).png"&gt;&lt;/a&gt;&lt;br&gt;
In the above example, list y elements fill with integer value as 1. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WlmNM1Sv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643952468/R5STMY9EF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WlmNM1Sv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627643952468/R5STMY9EF.png" alt="carbon (15).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ec1ZdHjH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644028933/8JKF8yygb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ec1ZdHjH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644028933/8JKF8yygb.png" alt="carbon (16).png"&gt;&lt;/a&gt;&lt;br&gt;
In the above example list y elements filled with float value as 1.5&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rleiQnMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644069552/JkJgsPYvL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rleiQnMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644069552/JkJgsPYvL.png" alt="carbon (17).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EUAFfKmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644156792/fV7EBpXFO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EUAFfKmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644156792/fV7EBpXFO.png" alt="carbon (18).png"&gt;&lt;/a&gt;&lt;br&gt;
In the above example list y is filled with a string value as 'Explore'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5QofZrZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644185603/IxaaEjODH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5QofZrZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644185603/IxaaEjODH.png" alt="carbon (19).png"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yFusQ6BQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644206285/5ep4mBTOW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yFusQ6BQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1627644206285/5ep4mBTOW.png" alt="carbon (20).png"&gt;&lt;/a&gt;&lt;br&gt;
In the above example list y is filled with boolean value True.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Python zip() Function.</title>
      <dc:creator>Shaila B</dc:creator>
      <pubDate>Thu, 29 Jul 2021 13:37:48 +0000</pubDate>
      <link>https://dev.to/shaila_b_tmk/python-zip-function-2kgf</link>
      <guid>https://dev.to/shaila_b_tmk/python-zip-function-2kgf</guid>
      <description>&lt;h4&gt;
  
  
  Python zip() function :
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;zip()&lt;/strong&gt; function. It is used when there are two or more iterables and they need to be aggregated into one iterable.&lt;/p&gt;

&lt;p&gt;(or)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;zip()&lt;/strong&gt; method is to map the similar index of multiple containers so that they can be used just using as a single entity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax : zip(*iterators)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For references see the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list1 = [1, 2, 3, 4]

list2 = [5, 6, 7, 8]

result = list(zip(list1, list2))

print(result)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[(1, 4), (2, 5), (3, 6)]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When two lists have an equal number of elements, 3rd list with elements from both lists can be created using zip().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list1 = [1, 2, 3]

list2 = [4, 5, 6]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here the list1 and list2 have an equal number of elements. The result list contains the list1 and list2 elements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;result = list(zip(list1, list2))

print(result)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[(1, 4), (2, 5), (3, 6)]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When two lists have an equal number of elements, we can create a dictionary with these elements, the elements of the first list will be considered as keys and the elements of the second list will be considered as values.&lt;/p&gt;

&lt;p&gt;For example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list1 = [1, 2, 3]

list2 = [4, 5, 6]

result = dict(zip(list1, list2))

print(result)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{1: 4, 2: 5, 3: 6}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Let's see some more examples below
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Creating a list using columns and values or data.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ['employee_id', 'employee_name', 'employee_salary']

values = [1, 'John', '50000']

employee_details = list(zip(columns, values))

print(employee_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[('employee_id', 1), ('employee_name', 'John'), ('employee_salary', '50000')]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating a dictionary using columns and values.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ['employee_id', 'employee_name', 'employee_salary']

values = [1, 'Smith', 80000]

employee_details = dict(zip(columns, values))

print(employee_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'employee_id': 1, 'employee_name': 'Smith', 'employee_salary': 80000}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;We can apply zip() on tuples.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ('employee_id', 'employee_name', 'employee_salary')

values = (1, 'Eshani', 50000)

employee_details = dict(zip(columns, values))

print(employee_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'employee_id': 1, 'employee_name': 'Eshani', 'employee_salary': 50000}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;zip() function for multiple data.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ('employee_id', 'employee_name', 'employee_salary')

values = (
    (1, 'John', 50000),
    (2, 'Smith', 80000),
    (3, 'Ruhi', 60000),
    (4, 'Arnav', 50000),

)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above, we have multiple employee data so here we are going to use list comprehension&lt;/p&gt;

&lt;p&gt;We need to apply zip on each record to create a list of dictionaries. Example using list comprehensions. We are applying zip and then dictionary on each employee.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;employee_details = [list(zip(columns, employee)) for employee in values]

print(employee_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[[('employee_id', 1), ('employee_name', 'John'), ('employee_salary', 50000)], [('employee_id', 2), ('employee_name', 'Smith'), ('employee_salary', 80000)], [('employee_id', 3), ('employee_name', 'Ruhi'), ('employee_salary', 60000)], [('employee_id', 4), ('employee_name', 'Arnav'), ('employee_salary', 50000)]]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;We can use dictionary comprehension.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ('employee_id', 'employee_name', 'employee_salary')

values = [
          (1, 'Teena', 80000),
          (2, 'Mouna', 60000),
          (3, 'Janvi', 40000),

         ]


employees_details = [dict(zip(columns, employee)) for employee in values]

print(employees_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{'employee_id': 1, 'employee_name': 'Teena', 'employee_salary': 80000}, {'employee_id': 2, 'employee_name': 'Mouna', 'employee_salary': 60000}, {'employee_id': 3, 'employee_name': 'Janvi', 'employee_salary': 40000}]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the map as we are trying to apply a row-level transformation to convert each employee into the dictionary with columns as keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;columns = ('employee_id', 'employee_name', 'employee_salary')

values = [
          (1, 'John', 50000),
          (2, 'Smith', 80000),
          (3, 'Sanvi', 60000)
         ]

employee_details = list(map(lambda employee: dict(zip(columns, employee)), values))

print(employee_details)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{'employee_id': 1, 'employee_name': 'John', 'employee_salary': 50000}, {'employee_id': 2, 'employee_name': 'Smith', 'employee_salary': 80000}, {'employee_id': 3, 'employee_name': 'Sanvi', 'employee_salary': 60000}]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Printing data type of the first element employees_list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(employee_details[0])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'employee_id': 1, 'employee_name': 'John', 'employee_salary': 50000}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Printing size of employees_list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(len(employee_details))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>programming</category>
      <category>coding</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Write your own web server in python.</title>
      <dc:creator>Shaila B</dc:creator>
      <pubDate>Thu, 22 Jul 2021 19:46:39 +0000</pubDate>
      <link>https://dev.to/shaila_b_tmk/write-your-own-web-server-in-python-1kbb</link>
      <guid>https://dev.to/shaila_b_tmk/write-your-own-web-server-in-python-1kbb</guid>
      <description>&lt;p&gt;In python, there are libraries that allow you to write your own web server in a few lines.&lt;/p&gt;

&lt;p&gt;For Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XgA1CjaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/legwwn284xortn8dfriq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XgA1CjaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/legwwn284xortn8dfriq.png" alt="img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you run this, your machine will listen on port 8000 for requests.&lt;/p&gt;

&lt;p&gt;In a web browser, If you navigate to &lt;a href="http://127.0.0.1:8000/"&gt;http://127.0.0.1:8000/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The browser will get the response as below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3j8fVUHJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5inmrscd79r3iwkwp0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3j8fVUHJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5inmrscd79r3iwkwp0r.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>development</category>
      <category>coding</category>
    </item>
    <item>
      <title>Let’s learn about the special variable __name__ in python.</title>
      <dc:creator>Shaila B</dc:creator>
      <pubDate>Sat, 03 Jul 2021 08:08:31 +0000</pubDate>
      <link>https://dev.to/shaila_b_tmk/let-s-learn-about-the-special-variable-name-in-python-5gg5</link>
      <guid>https://dev.to/shaila_b_tmk/let-s-learn-about-the-special-variable-name-in-python-5gg5</guid>
      <description>&lt;p&gt;In python, there is no main() function. When we run a python program, the code is given to the interpreter, then the given code is to be executed at the level 0 indentation, before doing that it will define a few special variables. &lt;strong&gt;name&lt;/strong&gt; is one such special variable. &lt;strong&gt;name&lt;/strong&gt; is a special variable that will store the current module name.&lt;br&gt;
Syntax : &lt;strong&gt;name&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wBoCdSLJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wz7imv64ol72ljwrt40.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wBoCdSLJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wz7imv64ol72ljwrt40.png" alt='A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"'&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_IvE-4Ym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5mzjxmb04yd34tpnwos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_IvE-4Ym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5mzjxmb04yd34tpnwos.png" alt='A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"'&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nh5aIdfc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdi327as3sgw2m0ven5t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nh5aIdfc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdi327as3sgw2m0ven5t.png" alt='A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"'&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1hzXQcXi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1w2c2gam786vw77xtq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1hzXQcXi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1w2c2gam786vw77xtq6.png" alt='A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"'&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
