<?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: Mrigendra Prasad</title>
    <description>The latest articles on DEV Community by Mrigendra Prasad (@justkoder).</description>
    <link>https://dev.to/justkoder</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%2F898739%2F6eb1ed6a-8535-4d1f-a75e-c31d5668cf1a.jpeg</url>
      <title>DEV Community: Mrigendra Prasad</title>
      <link>https://dev.to/justkoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/justkoder"/>
    <language>en</language>
    <item>
      <title>Recursion: One more way.</title>
      <dc:creator>Mrigendra Prasad</dc:creator>
      <pubDate>Fri, 23 Sep 2022 19:04:13 +0000</pubDate>
      <link>https://dev.to/justkoder/recursion-one-more-way-4ijb</link>
      <guid>https://dev.to/justkoder/recursion-one-more-way-4ijb</guid>
      <description>&lt;p&gt;So, now that you are familiar with iterators right? if not then&lt;/p&gt;

&lt;h3&gt;
  
  
  Iterators
&lt;/h3&gt;

&lt;p&gt;Iterators are one of the fundamental concepts of programming. It is used to loop through all the elements of an array and perform the same operation on all of them or you can perform an operation number of times like printing a text 100 times with just a few lines of code with the help of iterators. In Python iterators are "for loop" and "while loop". Let's take an example of factorial using for loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fact(n):
    f = 1
    if n == 0:
        return 1
    elif n == 1:
        return 1
    else:
        for i in range(1, n+1):
            f *= i
        return f

print(fact(5))
&amp;gt;&amp;gt;&amp;gt; 120
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But there is one more way to do that and that is &lt;strong&gt;recursion&lt;/strong&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Recursion
&lt;/h3&gt;

&lt;p&gt;Recursion is a technique by which a function calls itself but in its simpler form. It is an important concept and most of the time it is used in &lt;strong&gt;data structures&lt;/strong&gt;. Let's take the example of factorial using recursion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fact_re(n):
    if n == 1:
        return 1
    elif n == 0:
        return 1
    else:
        return n * fact_re(n -1)

print(fact_re(5))
&amp;gt;&amp;gt;&amp;gt; 120
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, here you can see that fact_re() is calling itself but the argument passed is less than that of the initial function. Hence, every time the function calls itself the argument becomes smaller and smaller, and at some point, it will become 1 since we have already provided a condition that if the argument is equal to 1 it will return 1 and the function will stop calling itself after reaching that condition.&lt;/p&gt;

&lt;p&gt;Here, if you compare both functions, the iterator one and the recursion one, you will find that the recursion one contains fewer lines of code and that's what programmers want. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Programmers are so lazy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recursion helps to develop logical thinking and improves problem-solving skills.&lt;br&gt;
It is easier to write and debug code for &lt;strong&gt;data structures&lt;/strong&gt; using recursion.&lt;br&gt;
It reduces time complexity for larger codes.&lt;/p&gt;
&lt;h3&gt;
  
  
  Types of recursion
&lt;/h3&gt;

&lt;p&gt;Yes, recursion also has different types. It is of three types basically:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Linear recursion&lt;/strong&gt;: If a recursive function is invoking itself at most one time during its execution then it is known as linear recursion. It can be a useful tool for processing a data sequence like lists or tuples in Python. For example:- The factorial function that we have seen above. Let's take another example to illustrate it better
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def power(x, n):
    if n == 0:
        return 1
    else:
        return x * power(x, n - 1)


print(power(3, 4))
&amp;gt;&amp;gt;&amp;gt; 81
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In the above example "x" is a number and "n" is the power. Here is the illustration:-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8tIRmfHb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn2llr8ndqqprsi7opuf.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8tIRmfHb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn2llr8ndqqprsi7opuf.jpeg" alt="It is an illustration of how recursion works" width="880" height="1104"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Binary Recursion&lt;/strong&gt;: In binary recursion, a recursive function calls itself twice in each execution. Let's understand it by an example.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most famous example is the Fibonacci series. It is a series of positive numbers in which each number is the sum of the preceding two numbers and it starts from 0 and 1.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         0 1 2 3 5 8 13 ....
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This is what it looks like.&lt;br&gt;
Now, let's print it using a recursive function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

print(fib(6))
&amp;gt;&amp;gt;&amp;gt; 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function returns the number at the given index, where n is the index that a user will provide. So here you can see line number 7, we have called the same function twice but in a much simpler form. Let's see another example where we will print an English ruler like&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               ---- 0
               ---
               --
               -
               --
               ---
               ---- 1
               ---
               --
               -
               --
               ---
               ---- 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;this. Give it a try before we will dive into solving this using the recursive function.&lt;/p&gt;

&lt;p&gt;Now if you have tried it by yourself let's solve it. Here, you can see a pattern i.e. dashes are decreasing from 4 to 1 and then increasing from 1 to 4, and at every line having maximum dashes, there is a number. So let's write a function that prints dashes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def draw_line(tick_length, tick_label=""):
    line = tick_length * "-"
    if tick_label:
        line += ' ' + tick_label
    return line

print(draw_line(4, 0))
&amp;gt;&amp;gt;&amp;gt; ----
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;draw_line() function accepts two arguments the length of the line and if any line has a label prints it. &lt;em&gt;Note: &lt;strong&gt;tick_label&lt;/strong&gt; should be a string&lt;/em&gt;.&lt;br&gt;
Now let's provide an interval so that the &lt;strong&gt;draw_line()&lt;/strong&gt; function prints the line according to the length and interval.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def draw_interval(center_length):
    if center_length &amp;gt; 0:
        draw_interval(center_length - 1)
        draw_line(center_length)
        draw_interval(center_length - 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function provides an interval to print the line.&lt;/p&gt;

&lt;p&gt;In this function, you can see that the draw_interval() function calls itself twice but in its simpler form.&lt;/p&gt;

&lt;p&gt;Now let's finally draw the ruler&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def draw_ruler(line_length, ruler_length):
    draw_line(line_length, "0")
    for j in range(1, ruler_length + 1):
        draw_interval(line_length - 1)
        draw_line(line_length, str(j))

print(draw_ruler(5, 6))
&amp;gt;&amp;gt;&amp;gt;
----- 0
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 1
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 2
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 3
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 4
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 5
-
--
-
---
-
--
-
----
-
--
-
---
-
--
-
----- 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulation, you have drawn your ruler using Python.&lt;/p&gt;

&lt;p&gt;In the function &lt;strong&gt;draw_ruler()&lt;/strong&gt; we have used &lt;strong&gt;for loop&lt;/strong&gt; because this function cannot be broken into a smaller form to generate a continuous number.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Recursion&lt;/strong&gt;:As the name suggests it is a process in which a function can call itself more than two times in each execution. This type of recursion is used to analyze the disk space usage of a file system because the number of recursive calls depends upon the entries within a given folder of a file system.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;In this article, we saw another way of iteration using a function that calls itself in every execution but a simpler form and we are calling that function a &lt;strong&gt;recursive function&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks For Reading&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>programming</category>
      <category>datastructures</category>
      <category>recursion</category>
      <category>python</category>
    </item>
    <item>
      <title>Classification of data structures in Python.</title>
      <dc:creator>Mrigendra Prasad</dc:creator>
      <pubDate>Mon, 19 Sep 2022 16:13:43 +0000</pubDate>
      <link>https://dev.to/justkoder/classification-of-data-structures-in-python-2lbi</link>
      <guid>https://dev.to/justkoder/classification-of-data-structures-in-python-2lbi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt; is one of the most popular programming languages in the world. It is used for so many things such as making backends for websites, artificial intelligence, data science, and much more. We need lots and lots of data sets to work in these fields, for example, on websites there are lots of data of may be products or users which we need to store in such a way that they can be accessed efficiently. Then in artificial intelligence, we need data in millions. So to manage this amount of data, we structure them so they can be accessed efficiently. This structure of data is called &lt;strong&gt;Data Structures&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The format for efficiently storing, organizing, and managing data is called &lt;strong&gt;Data Structures&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What are the different types of data structures?
&lt;/h3&gt;

&lt;p&gt;Python provides different kinds of data structures to facilitate problem-solving. These can be classified as linear or non-linear, primitive or non-primitive, and contiguous or non-contiguous. Let's talk about all of them in detail.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Primitive&lt;/strong&gt;: These are the basic set of different data types from which all the other data types are constructed. It is also called simple data type. It cannot be null (empty). This includes integers, strings, floats, and boolean in Python.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Non-Primitive&lt;/strong&gt;: These are the type of data structures that can store more than one type of data. It is also called complex data type. It can be null. This includes arrays, lists, tuples, sets, dictionaries, linked lists, stacks, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contiguous&lt;/strong&gt;: As its name suggests that these contain those values that are stored in contiguous memory locations. For example, in an array, the elements are stored in an adjacent memory location one after another. In this type of data structure, the data element can be of primitive data type or complex data type. This includes arrays, tuples, sets, objects, strings, lists, maps, and dictionaries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Non-Contiguous&lt;/strong&gt;: In this type of data structure, the data elements are scattered across different memory locations. Here each data item is stored in the form of nodes which keeps a link to one or more other nodes in the collection. This includes linked lists, maps, and graphs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Linear&lt;/strong&gt;: In linear data structures, the elements are accessed in a sequential order irrespective of whether the data items are contiguous or non-contiguous. This includes arrays, linked lists, stacks, queues, and lists.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Non-Linear&lt;/strong&gt;: In a nonlinear data structure,  the elements are present in the form of nodes and they are accessed in nonlinear order and they are stored in noncontiguous order. Examples include trees and graphs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Built-in Data Structures in Python.
&lt;/h3&gt;

&lt;p&gt;Python provides four built-in data structures that cover almost 80% of the real-world data structures. Let's discuss them in detail.&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;List&lt;/strong&gt;: Lists are the simplest container that comes inbuilt in Python. In other words, lists are the collection of elements within the [ ] brackets and separated by commas. A single list can contain elements of different data types and it can contain multiple elements of the same data type. A list is a mutable type which means the elements can be altered after the creation of the list.&lt;br&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, "Hello", 3.4, 2 + 3j, 2, 3]
      print(l1)
      &amp;gt;&amp;gt;&amp;gt; [1, 2, 3, "Hello", 3.4, 2 + 3j, 2, 3]
      print(l1[0])
      &amp;gt;&amp;gt;&amp;gt; 1
      print(l1[2:3])
      &amp;gt;&amp;gt;&amp;gt; [3, "Hello"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: A list can contain another list, tuples, dictionaries, and sets inside it. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.&lt;strong&gt;Tuple&lt;/strong&gt;: A tuple is also a collection of elements inside ( ) and they are separated by commas. It shares lots of functionality with the list like it can contain elements of multiple data types, accessing elements by indexing. A tuple is immutable which means we cannot change elements inside it once it has been created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     t1 = (4, 5, 6, 4, 5, "World")
     print(t1)
     &amp;gt;&amp;gt;&amp;gt; (4, 5, 6, 4, 5, "World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;strong&gt;Dictionary&lt;/strong&gt;: A dictionary is a collection of key-value pairs within { } brackets in python. In a dictionary, every element has its own key which is used to access the element unlike in lists and tuples where we use the index number to access elements. Here key and value are separated by a colon (":") and the key-value pair is separated by commas. Values inside a dictionary can be of any data type or they can be lists or tuples or even dictionaries as well but keys should be immutable and non-repeating. Keys are case sensitive which means the same name but different cases will be treated differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     d1 = {"key1":1, "key2":[1,2,3], "key3":(4,5,6), "key4":"Hello"}
     print(d1)
     &amp;gt;&amp;gt;&amp;gt; {"key1":1, "key2":[1,2,3], "key3":(4,5,6), "key4":"Hello"}
     print(d1["key1"])
     &amp;gt;&amp;gt;&amp;gt; 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.&lt;strong&gt;Set&lt;/strong&gt;: A set is an unordered collection data type that is mutable, and iterable but it does not contain multiple elements of the same data type. The main advantage of using a set collection is that it has a highly optimized method to check whether the specific element is present in the set or not. Since a set is unordered hence we cannot access elements by index numbers like in lists. For creating a set we use { } braces&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     s1 = {1, 2, 3, 4, 5}
     print(s1)
     &amp;gt;&amp;gt;&amp;gt; {1, 2, 3, 4, 5}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;In this article, we talked about different types of data structures present in Python. And then we saw the built-in data structures in Python and their examples. Hope you have enjoyed it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Operators in Python</title>
      <dc:creator>Mrigendra Prasad</dc:creator>
      <pubDate>Mon, 19 Sep 2022 14:38:05 +0000</pubDate>
      <link>https://dev.to/justkoder/operators-in-python-313p</link>
      <guid>https://dev.to/justkoder/operators-in-python-313p</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;"Operators are one of the main concepts in programming"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, we have variables and different types of data types and we need to perform some operations with our data or values like calculations or comparisons, etc. So, here comes the operators which help us to perform these operations. In Python, we have different types of operators and these are:&lt;/p&gt;

&lt;p&gt;(i) &lt;strong&gt;Logical Operators&lt;/strong&gt;: Logical operators are the operators which compare two expressions and return the value in True or False. Following are the logical operators:&lt;/p&gt;

&lt;p&gt;1) &lt;strong&gt;and&lt;/strong&gt;: It compares two expressions and returns True if both the operators return True. For example -: let's take two expressions A and B then &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6zmPThLo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2q9nn5c953pb29npl1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6zmPThLo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2q9nn5c953pb29npl1p.png" alt='Table shows how the "and" operator operates the result of the two expressions' width="495" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) &lt;strong&gt;or&lt;/strong&gt;: It compares two expressions and returns True if one of the expressions returns True. For example -: let's take two expressions &lt;br&gt;
A and B then &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3jOtP_Yt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9g9hf23c0oc6apmj2p10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3jOtP_Yt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9g9hf23c0oc6apmj2p10.png" alt='Table shows how the "or" operator operates the result of the two expressions' width="471" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) &lt;strong&gt;not&lt;/strong&gt;: It returns True if the expression returns False and returns False if the expression returns True.&lt;/p&gt;

&lt;p&gt;(ii) &lt;strong&gt;Equality Operators&lt;/strong&gt;: These operators strictly check the equality of two values. The following operators belong to this equality operator: &lt;/p&gt;

&lt;p&gt;1) &lt;strong&gt;==&lt;/strong&gt;: Equivalent Operator, returns True if both the value are equal. For example &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            2 == 2
            returns True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2) &lt;strong&gt;!=&lt;/strong&gt;: Not Equivalent, returns True if both values are not equal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            2 != 3
            returns True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3) &lt;strong&gt;is&lt;/strong&gt;: Same Identity, it is for reference equality. It checks if two variables point toward the same object.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            a = 1
            b = 1
            a is b
            returns True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4) &lt;strong&gt;is not&lt;/strong&gt;:Different Identity, it checks if both variables don't point toward the same object.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            a = 1
            b = "1"
            a is not b
            returns True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(iii) &lt;strong&gt;Comparison Operators&lt;/strong&gt;: Comparison operators are the operators which are used to compare two values. Following are the comparison operators available in Python:&lt;/p&gt;

&lt;p&gt;1) &amp;lt;: Less than, it checks if the left-hand side value is less than that of the right-hand side value if so it returns True.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             2 &amp;lt; 3
             returns True
             4 &amp;lt; 2
             returns False 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2) &amp;gt;: Greater than, it checks if the left-hand side value is greater than that of the right-hand side value, if so it returns True.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             2 &amp;gt; 3
             returns False
             4 &amp;gt; 2
             returns True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3) &amp;lt;=: Less than equal to, it checks if the left-hand side value is less than or equal to that of the right-hand side value, if so it returns True.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             3 &amp;lt;= 3
             return True
             2 &amp;lt;= 4
             return True
             3 &amp;lt;= 2
             return False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4) &amp;gt;=: Greater than equal to, it checks if the left-hand  side value is greater than or equal to that of the right-hand side value&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             3 &amp;gt;= 3
             return True
             2 &amp;gt;= 4
             return False
             3 &amp;gt;= 2
             return True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(iv) &lt;strong&gt;Arithmetic Operators&lt;/strong&gt;: Arithmetic operators are used to performing mathematical operations like calculations. Following are the arithmetic operators present in Python:&lt;/p&gt;

&lt;p&gt;1) +: Use for addition&lt;/p&gt;

&lt;p&gt;2) -: Use for subtraction&lt;/p&gt;

&lt;p&gt;3) *: Use for multiplication&lt;/p&gt;

&lt;p&gt;4) /: Use for division&lt;/p&gt;

&lt;p&gt;5) //: Integer division, returns the integer part of the quotient For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            13 // 4
            return 3
            11 // 5 
            return 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;6)  %: Modulo operator: it returns the remainder of the division For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            11 % 4 
            return 3
            15 % 6
            return 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There are many other operators in Python like the &lt;strong&gt;Bitwise&lt;/strong&gt; operator and &lt;strong&gt;Sequence&lt;/strong&gt; operator. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;So in this article, we have talked about operators and the different types of operators present in Python programming language. Hope you have enjoyed it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks for reading!&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Data Types in Python</title>
      <dc:creator>Mrigendra Prasad</dc:creator>
      <pubDate>Thu, 08 Sep 2022 10:30:38 +0000</pubDate>
      <link>https://dev.to/justkoder/data-types-in-python-1hcj</link>
      <guid>https://dev.to/justkoder/data-types-in-python-1hcj</guid>
      <description>&lt;blockquote&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Data Structure And Algorithms using Python
&lt;/h1&gt;

&lt;p&gt;Python is one of the most popular programming languages. It is a high-level, easy-to-learn interpreted programming language. It was developed by Guido Van Rossum in 1991. Today, Python is used for many purposes like software development, data analysis, machine learning, robotics, backend web development, desktop application, GUIs, 2d game development, etc. So here in this repository, I am adding Data Structure and Algorithm concepts and problems and their solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Types in Python
&lt;/h3&gt;

&lt;p&gt;In programming, we need to classify the data or value so that we can perform different operations on different data types &lt;br&gt;
for example, The "+" operator will add two values if they are integer or #float while the same operator will concatenate two strings &lt;br&gt;
So we can see that the same operator operates different types of values differently based on its data type, hence classifying the values with different data types is very important&lt;/p&gt;

&lt;h3&gt;
  
  
  Data types available in Python
&lt;/h3&gt;

&lt;p&gt;(i)  &lt;strong&gt;Integer&lt;/strong&gt;&lt;br&gt;
  -&amp;gt; In Python, we represent whole numbers using int (integer). In integers, numbers can lie anywhere from negative infinity to positive infinity which makes it convenient for us to deal with integers without caring much about the memory size it will take because Python will handle it automatically.&lt;/p&gt;

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

 print(type(x))

 output &amp;gt;&amp;gt;  &amp;lt;class "int"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(ii)  &lt;strong&gt;Float&lt;/strong&gt;&lt;br&gt;
  -&amp;gt; In Python to represent a real number having decimal point we use float. It represents both rational and irrational numbers. There can be any number of digits before or after the decimal point.&lt;/p&gt;

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

 print(type(x))

 output &amp;gt;&amp;gt;  &amp;lt;class "float"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(iii)  &lt;strong&gt;Complex Numbers&lt;/strong&gt;&lt;br&gt;
   -&amp;gt; In Python, we can also work with the complex number where we represent an imaginary number. For example, a + bj is a complex number where a and b are real numbers and j         is an imaginary number.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  x = 2 + 3j

  print(type(x))

  output &amp;gt;&amp;gt; &amp;lt;class "complex"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(iv) &lt;strong&gt;String&lt;/strong&gt;&lt;br&gt;
   -&amp;gt; String values are the combination of letters, characters, numbers, and special characters inside the single, double, or even triple quotation mark. Most of the &lt;br&gt;
      time we use single and double quotation marks for single-line strings and while we want to write multi-line strings we use triple quotation marks.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  x = "Hello World"

  print(type(x))

  output &amp;gt;&amp;gt; &amp;lt;class 'str'&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(v)  &lt;strong&gt;Boolean&lt;/strong&gt;&lt;br&gt;
   -&amp;gt; Boolean has only two values True (T is always capital) and False (F is always capital). We use boolean data type when we have to make a decision or write conditional statements. We can also represent boolean values by using numbers such as 1 for True and 0 for False.&lt;/p&gt;

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

  print(type(x))

  output &amp;gt;&amp;gt; &amp;lt;class 'bool'&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(vi)  &lt;strong&gt;None&lt;/strong&gt;&lt;br&gt;
   -&amp;gt; Suppose a situation where you have to declare a variable without initializing the variable then there comes a "none" type to save you. It is used to declare a &lt;br&gt;
      variable with any initial value.&lt;/p&gt;


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

&lt;p&gt;print(type(x))&lt;/p&gt;

&lt;p&gt;output &amp;gt;&amp;gt; &amp;lt;class 'NoneType'&amp;gt;&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Summary&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;These are the data types available in python and we will discuss them in details in my next post &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks For Reading&lt;/p&gt;
&lt;/blockquote&gt;

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