<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rashmi on Medium]]></title>
        <description><![CDATA[Stories by Rashmi on Medium]]></description>
        <link>https://medium.com/@rashmichoudhary019?source=rss-df9510b017cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*IEVJof30dSxU8j_O</url>
            <title>Stories by Rashmi on Medium</title>
            <link>https://medium.com/@rashmichoudhary019?source=rss-df9510b017cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:21:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rashmichoudhary019/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Loops and Conditional Statement in Python]]></title>
            <link>https://python.plainenglish.io/loops-and-conditional-statement-in-python-d9801d6a82db?source=rss-df9510b017cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9801d6a82db</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[conditional-statements]]></category>
            <category><![CDATA[loops-in-python]]></category>
            <dc:creator><![CDATA[Rashmi]]></dc:creator>
            <pubDate>Sun, 28 Dec 2025 07:23:21 GMT</pubDate>
            <atom:updated>2026-02-07T12:54:18.576Z</atom:updated>
            <content:encoded><![CDATA[<p>When you start learning Python, two of the most powerful concepts you’ll use again and again are <strong>conditional statements</strong> and <strong>loops</strong>. They form the backbone of logic and repetition in your programs. In this blog, you’ll learn what they are, how they work, and where to use them — with examples that are easy to understand.</p><h3>What are Operator?</h3><p>In Python, <strong>operators</strong> are special symbols that perform operations on values and variables.<br> They are the building blocks of expressions and logic in any Python program.</p><p>In this blog, I will not talk about operator since this is about conditional statements and loops in python. But you must know about operatore before learning if-else Statement or for loop. <br>I will explain about it in short here.</p><p><strong><em>Types of Operator:</em></strong></p><ol><li><strong>Arithmetic Operator:</strong> Used for mathematical Calculation ( +, — , * , / , % , **, //)</li><li><strong>Assignment Operator:</strong> Used to assign values to variable (=, +=, -=, /=, *=)</li><li><strong>Comparison Operator:</strong> Used to compare two values. They always return True or False. (==, &gt;, &lt;, ≥, ≤, !=)</li><li><strong>Logical Operator:</strong> Used to combine conditions. (and, or, not)</li><li><strong>Bitwise Operator:</strong> Operate on binary values. (&amp;, ^, ~, |, &lt;&lt;, &gt;&gt;)</li><li><strong>Membership Operator:</strong> Used to check if a value exists in a sequence.<br>It returns true or false. ( in, not in )</li></ol><blockquote><strong>Syntax: </strong><strong>if value in collection</strong></blockquote><pre>arr = [1,2,4,5]<br><br>if 5 in arr:<br>    print(&quot;5 is present in array&quot;)<br><br>if 7 not in arr:<br>    print(&quot;7 is not in array&quot;)</pre><p>7. <strong>Identity Operator:</strong> Used to compare <strong>memory location</strong>, not value. ( is , is not )</p><blockquote><strong>Syntax</strong>: obj1 is obj2 <br>is checks whether both variable points to the same object in memory or not.<br>🚫 This does not compare value</blockquote><pre>a = []<br>b = []<br><br>print(a == b)  # True (values same)<br>print(a is b)  # False (different objects)</pre><p><strong><em>When to use identity operator?</em></strong><br>- Checking for none <br>- Checking Singleton objects</p><pre>data = None<br><br>if data is None:<br>    print(&quot;No data&quot;)<br><br>flag = True<br><br>if flag is True:<br>    print(&quot;True flag&quot;)</pre><h3><strong>What are Conditional Statements ?</strong></h3><p>Conditional statements allow your program to make decisions.<br> They check a condition (True/False) and execute code based on whether the condition is satisfied.<br><em>Python has </em><strong><em>three</em></strong><em> key conditional keywords:</em></p><ol><li>if Statement</li></ol><p>Used to run a block of code only when a condition is true.</p><pre>x = 10<br><br>if x &gt; 5:<br>   print(&quot;x is greater than 5&quot;)<br><br><br>#Here, the condition ( x &gt; 5 ) is true, <br>#therefore, the if block will execute</pre><p>2. if-else Statement</p><p>When condition is true, it executes if block, otherwise else block.</p><pre>x = 3<br><br>if x &gt; 5:<br>    print(&quot;x is greater than 5&quot;)<br>else:<br>    print(&quot;x is not greater than 5&quot;)</pre><p>3. if-elif-else Statement</p><p>Allows you to check multiple conditions sequentially. elif (short for &quot;else if&quot;) runs only if previous conditions were False. The final else catches anything that didn&#39;t match.</p><pre>x = 12<br><br>if x &gt; 20:<br>    print(&quot;x is greater than 20&quot;)<br>elif x &lt; 10:<br>    print(&quot;x is less than 10&quot;)<br>else:<br>    print(&quot;x is greater than 10 and less than 20&quot;)<br><br>#Here, the first condition ( x &gt; 15 ) is false, <br>#elif condition is also false,<br>#therefore, it will execute the else block</pre><p>4. match-case Statement</p><p>What if you have to match many condition? You will have to write many if-elif statement. <br>But wait, instead of writing long if-elif ladder you can use match-case.</p><blockquote><strong>Syntax:</strong><br>match expression:<br>⠀ case x:<br>⠀⠀ code block<br>⠀ case y:<br>⠀⠀ code block<br>⠀ case z:<br>⠀⠀ code block</blockquote><pre>day = 2<br><br>match day:<br>    case 1:<br>        print(&quot;Monday&quot;)<br>    case 2:<br>        print(&quot;Tuesday&quot;)<br>    case 3:<br>        print(&quot;Wednesday&quot;)<br>    case _:<br>        print(&quot;Invalid day&quot;)<br><br>#case_ means_default case</pre><h4>Real-life usage</h4><p>Checking login Credentials</p><pre>username = &quot;admin&quot;<br>password = &quot;1234&quot;<br><br>if username == &quot;admin&quot; and password == &quot;1234&quot;:<br>    print(&quot;Login successful&quot;)<br>else:<br>    print(&quot;Invalid credentials&quot;)</pre><h3>Loops in Python</h3><p>Loops let you repeat a block of code multiple times without writing it manually again and again.</p><p>Python provides two types of loop:</p><ol><li>for loop</li></ol><p>Used to iterate over a sequence (like a list, string, or range) or any iterable object. It is best used when you know in advance how many times the code should run.</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br><br>for fruit in fruits:<br>    print(fruit)</pre><p>2. while loop</p><p>Repeatedly executes a block of code as long as a specified condition remains <strong>True</strong>. It is typically used when the number of iterations is not known beforehand.</p><pre>count = 1<br><br>while count &lt;= 5:<br>    print(count)<br>    count += 1</pre><h3>Using break, continue and pass</h3><ol><li>break</li></ol><p>Stops the loop immediately. It doesn’t execute the loop again once it encounter break.</p><pre>for i in range(10):<br>    if i == 5:<br>        break<br>    print(i)<br><br>#When i==5, it stops the loop execution</pre><p>2. continue</p><p>Skips the current iteration and moves to the next one. When the code encounter continue statement, it skips the further line of code and start next iteration.</p><pre>for i in range(6):<br>    if i == 3:<br>        continue<br>    print(i)<br><br>#When i==3, it skips further lines and move to i=4</pre><p>3. pass</p><p>A placeholder — it does nothing. Useful when you’re planning code but not ready to implement it yet.</p><pre>for i in range(3):<br>    pass</pre><h4><strong>Real-life Example:</strong></h4><p>Counting how many times a character appears in a string</p><pre>name = &quot;aarohi&quot;<br>count = 0<br><br>for letter in name:<br>    if letter == &quot;a&quot;:<br>        count += 1<br><br>print(&quot;Total count of &#39;a&#39;:&quot;, count)</pre><h3>Python Special Feature (Truthy and Falsy Value)</h3><p>Python treats some values as False automatically:</p><ul><li>0</li><li>0.0</li><li>“ ” (empty string)</li><li>[] (empty list)</li><li>{}</li><li>set()</li><li>None</li><li>False</li></ul><p>Everything else is Truthy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9801d6a82db" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/loops-and-conditional-statement-in-python-d9801d6a82db">Loops and Conditional Statement in Python</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Tutorial for Beginner: Introduction and Data types]]></title>
            <link>https://python.plainenglish.io/python-tutorial-for-beginner-introduction-and-data-types-f6499799ea6b?source=rss-df9510b017cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6499799ea6b</guid>
            <category><![CDATA[free-python-tutorials]]></category>
            <category><![CDATA[data-types-in-python]]></category>
            <category><![CDATA[beginner-guide]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rashmi]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 10:50:31 GMT</pubDate>
            <atom:updated>2025-12-18T07:02:07.916Z</atom:updated>
            <content:encoded><![CDATA[<p>A beginner-friendly guide to understanding python’s Syntax, variables, and data types.</p><p>Hello Everyone! In this tutorial we’ll walkthrough to the fundamentals of python. And I’ll also be adding<em> </em><strong><em>interview or Some basic questions</em></strong> related to this topic at the end of this tutorial — so be sure to stick around till the end! This questions will help you reinforce what you’ve learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r4R6TWxNXswnfySU" /><figcaption>Photo by <a href="https://unsplash.com/@hiteshchoudhary?utm_source=medium&amp;utm_medium=referral">Hitesh Choudhary</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Python?</h3><p>Python is an popular,high-level, open-source, object-oriented programming language know for its simple syntax and readability. It has a wide range of application including web development, software development, data science, Artificial intelligence and cyber security.</p><p>Python has many libraries and framework that is used for different purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YDv7bqdD4NfOrUHzT63BQ.jpeg" /><figcaption>This image is taken from instagram account @python.science</figcaption></figure><h3>Your First Program!</h3><p>If you have used any other language, then you must know about the tradition :)<br>The first program that we write or learn is “Hello World” program means printing Hello world string in the terminal.</p><p>Compared to other languages, In python it just take one line….</p><pre>print(&quot;Hello World&quot;)</pre><p>Yes, that’s all it take to print something! No boilerplate, no stress.</p><p>Print function has many parameters, one of them is <strong><em>‘end’</em></strong> that you will often use.</p><blockquote>end: It specify what to print at the end. Default is ‘\n’ means new line.</blockquote><pre>print(&quot;Hello!&quot;)<br>print(&quot;How are you?&quot;)</pre><blockquote><strong>Output: </strong><br>Hello!<br>How are you?</blockquote><pre>print(&quot;Hello!&quot;, end=&quot; &quot;)   # Here it means, print the space at the end<br>print(&quot;How are you?&quot;)</pre><blockquote>Output:<br>Hello! How are you?</blockquote><h3>Variable</h3><p><strong><em>A variable is a name that stores value in a memory.</em><br></strong>Think of it as a labelled container — you put some data inside it and use the label to access that data later.</p><pre>x = 10<br>name = &quot;xyz&quot;</pre><blockquote>x and name is the variable here.<br>10 and xyz is the value.</blockquote><p>Variable name has some constraints that you need to follow:</p><ol><li><em>A variable name can contain letter, number and underscore.</em></li><li><em>It cannot contain spaces or any special symbol other than underscore.</em></li><li><em>It can only start with letter or underscore but not with numbers.</em></li></ol><pre>name = &quot;xyz&quot;  #Valid<br>first_name = &quot;ABC&quot; #Valid<br>a1 = 78  #Valid <br>5name = &quot;xyz&quot;   #invalid</pre><h3>Mutable vs Immutable</h3><p>Before moving to data types, you need to know what <strong>Mutable and Immutable </strong>means.</p><blockquote>Mutable — You can change the contents of the object stored in memory<br>Immutable — You cannot change the contents of the object stored in a memory</blockquote><p>For example, Numeric data types are immutable</p><pre>x = 10<br>print(id(x))<br><br>x = x + 5<br>print(id(x))</pre><p>id() function returns the memory address of an object.</p><p>Here, in the above code, you will get two different value for id. Means, it created a new object. Instead of changing the x value at the same memory location, it created a new object at different location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xqPREJ-xyyvLg8sPSyrug.png" /><figcaption>Memory Address</figcaption></figure><p>Strings are immutable.<br>⛔ You cannot do this in string</p><pre>name = &quot;Alice&quot;<br>name[0] = &quot;H&quot;  ❌ #Invalid</pre><h3>Let’s talk about data types!</h3><p>Python has built-in data types like integers, floats, strings, booleans, lists, tuples, sets, dictionaries — each has different purpose and store different kinds of data.<br>It is <strong><em>dynamically typed</em></strong> means the variable type is decided during runtime. You don’t need to declare the type.</p><h4>Numeric types:</h4><p>Numeric data types are immutable.</p><ol><li><strong>Integer (int):</strong> Represent whole number, positive or negative, without a decimal point.</li></ol><pre>x = 10 <br>age = 30</pre><p>2. <strong>Float:</strong> Represent numbers with a decimal point</p><pre>price = 19.95</pre><p>3. <strong>Complex:</strong> Represent number with a real and an imaginary part</p><pre>z = 2 + 3j</pre><h4>Text type:</h4><ol><li><strong>String (str):</strong> Represent sequence of character, enclosed in single and double quotes.<br><em>String can be accessed using index.<br>It is immutable.</em></li></ol><pre>name = &quot;Alice&quot;<br>print(name[1])  #l</pre><h4>Boolean type:</h4><ol><li><strong>bool:</strong> Represent truth value, either True or False</li></ol><pre>isPrime = True</pre><h4>Sequence type:</h4><ol><li><strong>List:</strong> A list is an ordered, <em>mutable </em>collection of item. Item can be of different data types<br><em>Can be accessed using index.</em></li></ol><pre>#Represent from square bracket<br>list1 = [8,2,&quot;hello&quot;,5.8] <br>print(list1[2])   #hello<br>print(list1[0])   #8</pre><p>2. <strong>Tuple:</strong> A typle is an ordered, <em>immutable </em>collection of item.<br><em>Can be accessed using index.</em></p><pre>#Represent from round bracket<br>tuple1 = (2,3,5.3,&quot;nothing&quot;)<br><br>print(tuple1[2])   #5.3<br>print(tuple1[0])   #2</pre><p>3. <strong>Range:</strong> Represent an <em>immutable </em>sequence of numbers, Often used for looping.</p><pre>num = range(5)  #0,1,2,3,4</pre><h4>Set type:</h4><ol><li><strong>set: </strong>An unordered, immutable collection of item. <br><em>Index Concept is not applicable here. <br>It doesn’t store duplicate values.</em></li></ol><pre>#Represent from curly bracket<br>s = {4,5,6,8,2,3}</pre><h4>Mapping type:</h4><ol><li><strong>Dictionary (dict):</strong> An unordered, mutable collection of data containing key-value pairs. Key should be unique.</li></ol><pre># Represent using curly bracket<br>dict1 = {<br>   &quot;name&quot;: &quot;Alice&quot;,<br>   &quot;age&quot;: 20,<br>   &quot;isAdult&quot;: True<br>}</pre><h3>Type Casting</h3><p>The conversion of one data type into other data type is known as type casting.</p><p>There are two types of type conversion:</p><ol><li>Implicit conversion: Python automatically converts one data type to another when safe.</li></ol><pre>a = 5<br>b = 6.3<br><br>c = a + b   # int + float = float<br>print(c)<br>print(type(c))   #It will print the data type of c</pre><p>2. Explicit conversion: You convert the data type using casting function.</p><p>Common casting functions:</p><ul><li>int() → convert to integer</li><li>float() → convert to float</li><li>str() → convert to string</li><li>list() → convert to list</li><li>tuple() → convert to tuple</li><li>set() → convert to set</li><li>dict() → convert to dictionary</li></ul><pre>age = &quot;15&quot;<br>age_num = int(age)<br><br>list = [2,3,6,8,9]<br>new_tuple = tuple(list)</pre><h3>Questions?</h3><ol><li>Is python dynamically typed or statically typed? / Why python is dynamically typed?<br> → Python is dynamically typed since type is checked during runtime. We don’t declare data type.</li><li>Is python a compiled language or interpreted language? / How python runs?<br> → Python is an interpreted language since it executes code line by line instead of compiling it all at once.</li><li>Explain why strings and tuples are immutable?<br> → These are <strong>immutable</strong> because their size and content cannot be changed after creation. For string, immutablility ensure no unintended side effects in program. For tuples, immutablility ensures hashability.</li><li>What happens in memory when you modify a mutable object vs reassign a variable to a new object?<br> → While modifying, the object stays in the same memory location, and its content is updated. And while reassigning, The variable now points to a new object, and the old object remains unchanged (unless nothing references it, then it can be garbage collected).</li><li>What is the difference between shallow copy and deep copy?<br> → A <strong>shallow copy</strong> creates a new object, but <strong>does not create copies of the nested objects</strong> inside it.<br>The outer object is new, but inner objects are <strong>shared</strong> with the original.If you modify a nested object, the change reflects in both the original and the copied object.<br> → A <strong>deep copy</strong> creates a <strong>completely independent copy</strong> of the object, including all nested objects.<br>Modifying the deep copy <strong>does not affect</strong> the original object.</li></ol><h3><strong>Next Lesson: Operator and Loops</strong></h3><p>In this blog, You learned about variables and data types. Next, we will explore operator and loops in python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6499799ea6b" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/python-tutorial-for-beginner-introduction-and-data-types-f6499799ea6b">Python Tutorial for Beginner: Introduction and Data types</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>