<?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: NirmaniWarakaulla</title>
    <description>The latest articles on DEV Community by NirmaniWarakaulla (@nirmaniwarakaulla).</description>
    <link>https://dev.to/nirmaniwarakaulla</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%2F666451%2F0914acc1-b069-4457-9f0d-8fd709616dcd.png</url>
      <title>DEV Community: NirmaniWarakaulla</title>
      <link>https://dev.to/nirmaniwarakaulla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nirmaniwarakaulla"/>
    <language>en</language>
    <item>
      <title>Python Foundation with Data Structures &amp; Algorithms - Part 04</title>
      <dc:creator>NirmaniWarakaulla</dc:creator>
      <pubDate>Sun, 15 Aug 2021 04:14:35 +0000</pubDate>
      <link>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-04-49j0</link>
      <guid>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-04-49j0</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Python Decision Making&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Python supports the usual logical conditions from mathematics:&lt;/p&gt;

&lt;p&gt;Equals: a == b&lt;br&gt;
Not Equals: a != b&lt;br&gt;
Less than: a &amp;lt; b&lt;br&gt;
Less than or equal to: a &amp;lt;= b&lt;br&gt;
Greater than: a &amp;gt; b&lt;br&gt;
Greater than or equal to: a &amp;gt;= b&lt;/p&gt;

&lt;p&gt;These conditions can be used in several ways, most commonly in "if statements" and loops.&lt;br&gt;
An "if statement" is written by using the if keyword.&lt;/p&gt;

&lt;p&gt;Python relies on indentation (whitespace at the beginning of a line) to define scope in the code. Other programming languages often use curly-brackets for this purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using if Statement&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;using if-else Statement&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Multiple if Statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here all the true conditions will be executed.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;if-elif Statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even if all the conditions are true, only first True condition will be executed rest all will not be executed.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Nested if-else Statement&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Short Hand If&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you have only one statement to execute, one for if, and one for else, you can put it all on the same line:&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;if-else using Logical AND Operator&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;if-else using Logical OR Operator&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The pass Statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Find No is +ve/-ve&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Find the No is Even/Odd&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Find the No is Even/Odd ( Without using any Arithmetic Operator )&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Find the Greatest Between 2 No's&lt;/strong&gt;  &lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Find the Greatest Between 3 No's&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Calculate Ticket Price:&lt;/strong&gt;&lt;/p&gt;

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

</description>
      <category>python</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Python Foundation with Data Structures &amp; Algorithms - Part 03</title>
      <dc:creator>NirmaniWarakaulla</dc:creator>
      <pubDate>Thu, 12 Aug 2021 12:15:31 +0000</pubDate>
      <link>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-03-2i23</link>
      <guid>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-03-2i23</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Operators in Python&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Python language is rich in built-in operators and provides following types of operators.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Types of Operators&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;We have the following types of operators in Python programming −&lt;/p&gt;

&lt;p&gt;Arithmetic operators&lt;br&gt;
Assignment operators&lt;br&gt;
Relational/Comparison Operators&lt;br&gt;
Logical Operators&lt;br&gt;
Bitwise Operators&lt;br&gt;
Identity Operator&lt;br&gt;
Membership Operator&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arithmetic Operator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arithmetic operators are used with numeric values to perform common mathematical operations:&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=int(input("Enter First Number:"))
 b=int(input("Enter First Number:"))
 print("Addition:",a+b)
 print("Subtraction:",a-b)
 print("Multiplication:",a*b)
 print("Division",a/b)
 print("Floor Division:",a//b)
 print("Modulus",a%b)
 print("Exponentiation:",a**b)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter First Number:5&lt;br&gt;
Enter First Number:2&lt;br&gt;
Addition: 7&lt;br&gt;
Subtraction: 3&lt;br&gt;
Multiplication: 10&lt;br&gt;
Division 2.5&lt;br&gt;
Floor Division: 2&lt;br&gt;
Modulus 1&lt;br&gt;
Exponentiation: 25&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python Assignment Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Assignment operators are used to assign values to variables:&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a = 10
 print(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a = 10
 b = 20
 a = a + b
 print(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a = 10
 b = 20
 a += b
 print(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python Comparison/Relational Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Comparison operators are used to compare two values:&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a=10
b=20
c = a &amp;lt; b
print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=20
 c = a &amp;gt; b
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;False&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=20
 c = a &amp;lt;= b
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=20
 c = a &amp;gt;= b
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;False&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=20
 c = a == b
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;False&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=20
 c = a != b
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python Logical Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Logical operators are used to combine conditional statements:&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Logial AND&lt;/strong&gt; &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = 1
 print(x &amp;lt; 5 and x &amp;lt; 10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print(10 and 20)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;20&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logical OR&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = 1
 print(x &amp;lt; 5 or x &amp;gt; 4)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print(10 or 20)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logical NOT&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = 1
 print(not(x &amp;lt; 5 or x &amp;gt; 4))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;False&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=0
 print(not a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python Bitwise Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Bitwise operators are used to compare (binary) numbers:&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   a=10
   b=6
   print("Bitwise AND:",a&amp;amp;b)
   print("Bitwise OR:",a|b)
   print("Bitwise XOR:",a^b)
   print("Left Shift:",a&amp;lt;&amp;lt;2)
   print("Right Shift:",a&amp;gt;&amp;gt;2)
   print("1's Complement:",~a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Bitwise AND: 2&lt;br&gt;
Bitwise OR: 14&lt;br&gt;
Bitwise XOR: 12&lt;br&gt;
Left Shift: 40&lt;br&gt;
Right Shift: 2&lt;br&gt;
1's Complement: -11&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python Identity Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location:&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  l1=[1,2,3]
  l2=[1,2,3]
  print(l1==l2)
  print(l1 is l2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;br&gt;
False&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  l3=l2
  print(l2)
  print(l3)
  print(l2==l3)
  print(l2 is l3) 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[1, 2, 3]&lt;br&gt;
[1, 2, 3]&lt;br&gt;
True&lt;br&gt;
True&lt;/p&gt;

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

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

&lt;/div&gt;

&lt;p&gt;[1, 2, 3]&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Membership Operators&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Membership operators are used to test if a sequence is presented in an object:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;in - Evaluates to true if it finds a variable in the specified sequence&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;not in - Evaluates to true if it does not finds a variable in the specified sequence&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  L=[12,353,545,2,45,67,89,23]
  n=2
  print(n in L)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  print(n not in L)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;False&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Python Foundation with Data Structures &amp; Algorithms - Part 02</title>
      <dc:creator>NirmaniWarakaulla</dc:creator>
      <pubDate>Wed, 11 Aug 2021 11:05:12 +0000</pubDate>
      <link>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-02-1ecd</link>
      <guid>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-02-1ecd</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Python Variables&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Variables are containers for storing data values. Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.&lt;/p&gt;

&lt;p&gt;The interpreter allocates memory and determines what can be stored in the allocated memory depending on the data type of a variable. As a consequence, you can store integers, decimals, or characters in variables by assigning various data types to them.&lt;/p&gt;

&lt;p&gt;Every value in Python has a datatype. Different data types in Python are Numbers, List, Tuple, Strings, Dictionary, etc. Variables in Python can be declared by any name or even alphabets like a, aa, abc, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assigning Values to Variables&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = 10
 y = "MachineLearning.org.in"
 z = 3.14
 print(x)
 print(y)
 print(z)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10&lt;br&gt;
MachineLearning.org.in&lt;br&gt;
3.14&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variables do not need to be declared with any particular type, and can even change type after they have been set.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = 10
 x = "MachineLearning.org.in"
 print(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;MachineLearning.org.in&lt;/p&gt;
&lt;h5&gt;
  
  
  &lt;em&gt;Multiple Assignment&lt;/em&gt;
&lt;/h5&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a = b = c = 10
 print(a,b,c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;10 10 10&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a,b,c = 10,3.14,"MachineLearning.org.in"
 print(a)
 print(b)
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;10&lt;br&gt;
3.14&lt;br&gt;
MachineLearning.org.in&lt;/p&gt;
&lt;h5&gt;
  
  
  &lt;em&gt;Type Casting&lt;/em&gt;
&lt;/h5&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = str(3)  
 print(x)

 y = int(3) 
 print(y)

 z = float(3)
 print(z)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;3&lt;br&gt;
3&lt;br&gt;
3.0&lt;/p&gt;
&lt;h5&gt;
  
  
  &lt;em&gt;Get the Type&lt;/em&gt;
&lt;/h5&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = str(3)  
 print(type(x))

 y = int(3) 
 print(type(y))

 z = float(3)
 print(type(z))
&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; n = input("Enter any value:")
 print(n)
 print(type(n))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter any value:Machine Learning&lt;br&gt;
Machine Learning&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; n = int(input("Enter any value:"))
 print(n)
 print(type(n))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter any value:10&lt;br&gt;
10&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; n = float(input("Enter any value:"))
 print(n)
 print(type(n))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter any value:3.14&lt;br&gt;
3.14&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; n = str(input("Enter any value:"))
 print(n)
 print(type(n))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter any value:Machine Learning&lt;br&gt;
Machine Learning&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Concatenation&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = "Learning"
 print("Machine " + x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; x = "Machine "
 y = "Learning "
 z =  x + y
 print(z)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Machine Learning &lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Python has five standard data types −&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;Numbers&lt;br&gt;
String&lt;br&gt;
List&lt;br&gt;
Tuple&lt;br&gt;
Dictionary&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;1. Number&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a = 10
 print(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;delete number&lt;/em&gt;
&lt;/h5&gt;

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

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

&lt;/div&gt;

&lt;p&gt;NameError: name 'a' is not defined&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;2. String&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; s = "MachineLearning.org.in"
 print(s)           # Prints complete string
 print(s[0])        # Prints first character of the string
 print(s[7:15])     # Prints characters starting from 3rd to 5th
 print(s[7:])       # Prints string starting from 3rd character
 print(s * 2)       # Prints string two times
 print('www.' + s)  # Prints concatenated string
 print(s[:])        # Prints complete string with range start to end
 print(s[::])       # Prints complete string with range start to end with increment 1
 print(s[::2])      # Print String with increment of 2
 print(s[-1])       # print last character of a string
 print(s[-3:])      # print last 3 character of a string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;MachineLearning.org.in&lt;br&gt;
M&lt;br&gt;
Learning&lt;br&gt;
Learning.org.in&lt;br&gt;
MachineLearning.org.inMachineLearning.org.in&lt;br&gt;
&lt;a href="http://www.MachineLearning.org.in"&gt;www.MachineLearning.org.in&lt;/a&gt;&lt;br&gt;
MachineLearning.org.in&lt;br&gt;
MachineLearning.org.in&lt;br&gt;
Mcieerigogi&lt;br&gt;
n&lt;br&gt;
.in&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;3. List&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      L = [10,3.14,"Machine",45,'Learning',78.98,69,'.org.in']
      print(L)
      print(L[:])
      print(L[::])
      print(L[0])
      print(L[2:5])
      print(L[2:])
      print(L[:5])
      print(L[-1])
      print(L[-3:])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in']&lt;br&gt;
[10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in']&lt;br&gt;
[10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in']&lt;br&gt;
10&lt;br&gt;
['Machine', 45, 'Learning']&lt;br&gt;
['Machine', 45, 'Learning', 78.98, 69, '.org.in']&lt;br&gt;
[10, 3.14, 'Machine', 45, 'Learning']&lt;br&gt;
.org.in&lt;br&gt;
[78.98, 69, '.org.in']&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  L1 = [10,20,30]
  L2 = [40,50,60]
  print(L1 + L2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[10, 20, 30, 40, 50, 60]&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  L1 = [10,20,30]
  print(L1 * 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[10, 20, 30, 10, 20, 30, 10, 20, 30]&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;4. Tuples&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  T = (10,3.14,"Machine",45,'Learning',78.98,69,'.org.in')
  print(T)
  print(T[:])
  print(T[::])
  print(T[0])
  print(T[2:5])
  print(T[2:])
  print(T[:5])
  print(T[-1])
  print(T[-3:])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in')&lt;br&gt;
(10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in')&lt;br&gt;
(10, 3.14, 'Machine', 45, 'Learning', 78.98, 69, '.org.in')&lt;br&gt;
10&lt;br&gt;
('Machine', 45, 'Learning')&lt;br&gt;
('Machine', 45, 'Learning', 78.98, 69, '.org.in')&lt;br&gt;
(10, 3.14, 'Machine', 45, 'Learning')&lt;br&gt;
.org.in&lt;br&gt;
(78.98, 69, '.org.in')&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  T1 = [10,20,30]
  T2 = [40,50,60]
  print(T1 + T2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[10, 20, 30, 40, 50, 60]&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  T1 = [10,20,30]
  print(T1 * 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[10, 20, 30, 10, 20, 30, 10, 20, 30]&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;5. Dictionary&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  d = {}
  print(d)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;{}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  d = {'Name':'Kevin','Age':34,'Marks':89.58}
  print(d)
  print(d['Name'])
  print(d['Age'])
  print(d['Marks'])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;{'Name': 'Kevin', 'Age': 34, 'Marks': 89.58}&lt;br&gt;
Kevin&lt;br&gt;
34&lt;br&gt;
89.58&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  print(d.keys())
  print(d.values())
  print(d.items())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;dict_keys(['Name', 'Age', 'Marks'])&lt;br&gt;
dict_values(['Kevin', 34, 89.58])&lt;br&gt;
dict_items([('Name', 'Kevin'), ('Age', 34), ('Marks', 89.58)])&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>python</category>
    </item>
    <item>
      <title>Python Foundation with Data Structures &amp; Algorithms - Part 01</title>
      <dc:creator>NirmaniWarakaulla</dc:creator>
      <pubDate>Tue, 10 Aug 2021 07:21:42 +0000</pubDate>
      <link>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-01-31ld</link>
      <guid>https://dev.to/nirmaniwarakaulla/python-foundation-with-data-structures-algorithms-part-01-31ld</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction to Python Programming Language&lt;/strong&gt;
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What is Python?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;It is used for:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;artificial intelligence&lt;br&gt;
big data&lt;br&gt;
web development (server-side)&lt;br&gt;
software development&lt;br&gt;
mathematics&lt;br&gt;
system scripting&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Python Program&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("www.machinelearning.org.in")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.machinelearning.org.in"&gt;www.machinelearning.org.in&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Python")
 print("Data Science")
 print("Machine Learning")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Python&lt;br&gt;
Data Science&lt;br&gt;
Machine Learning&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Single Line Comment&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;Comments start with a #, and Python will render the rest of the line as a comment:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; 'print("Hello")  #This is a comment'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Hello&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; 'print("Python")
 print("Data Science")
 #print("Machine Learning")
 print("Deep Learnig")
 print("Artificial Intelligence")'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Python&lt;br&gt;
 Data Science&lt;br&gt;
 Deep Learnig&lt;br&gt;
 Artificial Intelligence&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Multiline Comment&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; '''
 print("Python")
 print("Data Science")
 print("Machine Learning")
 print("Deep Learning")
 '''
 print("Artificial Intelligence")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Artificial Intelligence&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Assign Value to a variable&lt;/em&gt;
&lt;/h5&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=10
 b=3.134
 c="Machine Learning"
 print(a)
 print(b)
 print(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;10&lt;br&gt;
 3.134&lt;br&gt;
 Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Value of a :",a)
 print("Value of b :",b)
 print("Value of c :",c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Value of a : 10&lt;br&gt;
 Value of b : 3.134&lt;br&gt;
 Value of c : Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print(a,b,c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3.134 Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Value of a :",a,"Value of b :",b,"Value of c :",c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Value of a : 10 Value of b : 3.134 Value of c : Machine &lt;br&gt;
 Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Value of a :",a,"\nValue of b :",b,"\nValue of c 
:",c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Value of a : 10 &lt;br&gt;
 Value of b : 3.134 &lt;br&gt;
 Value of c : Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Value of a :",a,end='\n')
 ("Value of b :",b,end='\n')
 print("Value of c :",c,end='\n')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Value of a : 10&lt;br&gt;
 Value of b : 3.134&lt;br&gt;
 Value of c : Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print("Value of a :",a,end=' ')
 print("Value of b :",b,end=' ')
 print("Value of c :",c,end=' ')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Value of a : 10 Value of b : 3.134 Value of c : Machine &lt;br&gt;
     Learning &lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Accepting User Inputs&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;input( ) accepts input and stores it as a string. Hence, if the user inputs a integer, the code should convert the string to an integer and then proceed.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; a=input("Enter any value:")
 print(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enter any value:Machine Learning&lt;br&gt;
Machine Learning&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print(type(a))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&amp;lt;  class 'str'  &amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note that type( ) returns the format or the type of a variable or a number&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Preprocessing - Stop Words Removing</title>
      <dc:creator>NirmaniWarakaulla</dc:creator>
      <pubDate>Tue, 13 Jul 2021 16:43:05 +0000</pubDate>
      <link>https://dev.to/nirmaniwarakaulla/preprocessing-stop-words-removing-1m1f</link>
      <guid>https://dev.to/nirmaniwarakaulla/preprocessing-stop-words-removing-1m1f</guid>
      <description>&lt;h2&gt;
  
  
  Stop words
&lt;/h2&gt;

&lt;p&gt;The idea of Natural Language Processing is to do some form of analysis, or processing, where the machine can understand, at least to some level, what the text means, says, or implies.&lt;/p&gt;

&lt;p&gt;This is an obviously massive challenge, but there are steps to doing it that anyone can follow. The main idea, however, is that computers simply do not, and will not, ever understand words directly. Humans don't either &lt;em&gt;shocker&lt;/em&gt;. In humans, memory is broken down into electrical signals in the brain, in the form of neural groups that fire in patterns. There is a lot about the brain that remains unknown, but, the more we break down the human brain to the basic elements, we find out the basic elements really are. Well, it turns out computers store information in a very similar way! We need a way to get as close to that as possible if we're going to mimic how humans read and understand text. Generally, computers use numbers for everything, but we often see directly in programming where we use binary signals (True or False, which directly translate to 1 or 0, which originates directly from either the presence of an electrical signal (True, 1), or not (False, 0)). To do this, we need a way to convert words to values, in numbers, or signal patterns. The process of converting data to something a computer can understand is referred to as "pre-processing."&lt;br&gt;
One of the major forms of pre-processing is going to be filtering out useless data. In natural language processing, useless words (data), are referred to as stop words.&lt;br&gt;
Immediately, we can recognize that some words carry more meaning than other words. We can also see that some words are just plain useless, and are filler words. &lt;br&gt;
Example :- "fluff" &lt;br&gt;
                    "umm."&lt;br&gt;
                    "uhh"&lt;br&gt;
We would not want these words taking up space in our database, or taking up valuable processing time. As such, we call these words "stop words" because they are useless, and we wish to do nothing with them.&lt;/p&gt;

&lt;p&gt;You can do this easily, by storing a list of words that you consider to be stop words. NLTK starts you off with a bunch of words that they consider to be stop words, you can access it via the NLTK corpus with using code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from nltk.corpus import stopwords&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is the list of stopwords in English Language:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;set(stopwords.words('english'))&lt;br&gt;
{'ourselves', 'hers', 'between', 'yourself', 'but', 'again', 'there', 'about', 'once', 'during', 'out', 'very', 'having', 'with', 'they', 'own', 'an', 'be', 'some', 'for', 'do', 'its', 'yours', 'such', 'into', 'of', 'most', 'itself', 'other', 'off', 'is', 's', 'am', 'or', 'who', 'as', 'from', 'him', 'each', 'the', 'themselves', 'until', 'below', 'are', 'we', 'these', 'your', 'his', 'through', 'don', 'nor', 'me', 'were', 'her', 'more', 'himself', 'this', 'down', 'should', 'our', 'their', 'while', 'above', 'both', 'up', 'to', 'ours', 'had', 'she', 'all', 'no', 'when', 'at', 'any', 'before', 'them', 'same', 'and', 'been', 'have', 'in', 'will', 'on', 'does', 'yourselves', 'then', 'that', 'because', 'what', 'over', 'why', 'so', 'can', 'did', 'not', 'now', 'under', 'he', 'you', 'herself', 'has', 'just', 'where', 'too', 'only', 'myself', 'which', 'those', 'i', 'after', 'few', 'whom', 't', 'being', 'if', 'theirs', 'my', 'against', 'a', 'by', 'doing', 'it', 'how', 'further', 'was', 'here', 'than'}&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Here is the code you can remove the stop words from your text:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; from nltk.corpus import stopwords
 from nltk.tokenize import word_tokenize

 example_sent = "This is a sample sentence, showing off the 
 stop words filtration."

 stop_words = set(stopwords.words('english'))
 word_tokens = word_tokenize(example_sent)
 filtered_sentence = [w for w in word_tokens if not w in 
 stop_words]
 filtered_sentence = []
 for w in word_tokens:
   if w not in stop_words:
    filtered_sentence.append(w)
 print(word_tokens)
 print(filtered_sentence)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;After removing the stop words you can see the output here:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;['This', 'is', 'a', 'sample', 'sentence', ',', 'showing', 'off', 'the', 'stop', 'words', 'filtration', '.']#word_tokens&lt;br&gt;
['This', 'sample', 'sentence', ',', 'showing', 'stop', 'words', 'filtration', '.']#filtered_sentence&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Spacy library you can do the same here&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import spacy #Import spacy library
nlp = spacy.blank("en") #get english stopwords

from spacy.lang.en.stop_words import STOP_WORDS #Put all the  
stopwords into a variable called STOP_WORDS

print(STOP_WORDS) #Print all the stopwords
len(STOP_WORDS) #Length of stopword

nlp.vocab[“the”].is_stop #Checking if a word is a stopword

for word in doc:     #Print all the stopwords in the given doc
if word.is_stop == True:
    print(word)

for word in doc: #Remove all the stopwords in the given doc 
and print remaining doc
if word.is_stop == False:
    print(word)

[word for word in doc if word.is_stop == False] #Remove all 
the stopwords in the given doc and print remaining doc 
separating by words
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;How can we add our own stopword to the corpus and remove a stopword from the corpus?&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; STOP_WORDS.add(“Lol”) #Add new stopword into corpus as you wish
 STOP_WORDS.remove(“Lol”) #Remove new stopword into corpus as you wish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can refer my github repository-python file here.&lt;/p&gt;

&lt;p&gt;[&lt;a href="https://github.com/NirmaniWarakaulla/DevPostExcersice/blob/main/Stop_Words_Removing.py"&gt;https://github.com/NirmaniWarakaulla/DevPostExcersice/blob/main/Stop_Words_Removing.py&lt;/a&gt;]&lt;/p&gt;

</description>
      <category>nlp</category>
      <category>python</category>
      <category>jupyter</category>
      <category>stopwords</category>
    </item>
  </channel>
</rss>
