<?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: Vishnu Vardhan Reddy</title>
    <description>The latest articles on DEV Community by Vishnu Vardhan Reddy (@vishnuvardhan2005).</description>
    <link>https://dev.to/vishnuvardhan2005</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%2F1334212%2F8e401418-3317-4b95-94df-3aa8f5eb8b85.png</url>
      <title>DEV Community: Vishnu Vardhan Reddy</title>
      <link>https://dev.to/vishnuvardhan2005</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishnuvardhan2005"/>
    <language>en</language>
    <item>
      <title>Python List Comprehensions</title>
      <dc:creator>Vishnu Vardhan Reddy</dc:creator>
      <pubDate>Thu, 07 Mar 2024 06:25:01 +0000</pubDate>
      <link>https://dev.to/vishnuvardhan2005/python-list-comprehensions-448n</link>
      <guid>https://dev.to/vishnuvardhan2005/python-list-comprehensions-448n</guid>
      <description>&lt;p&gt;Python list comprehensions helps to write concise code for making new lists from existing lists.&lt;/p&gt;

&lt;p&gt;Let's look at some basic examples to understand list comprehensions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# doubling elements
nums = [1, 2, 3, 4]
doubled_nums = [n*2 for n in nums]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# squared elements
nums = [*range(1,11,1)]
print(nums)
squared_nums = [n*n for n in nums]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# filtering even numbers
nums = [1,5,3,4,6,2,7,8]
even_nums = [n for n in nums if n%2 == 0]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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