<?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 akshara on Medium]]></title>
        <description><![CDATA[Stories by akshara on Medium]]></description>
        <link>https://medium.com/@cutepandaakhi717?source=rss-884004e62eee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Y8vVfxNZxoUKDSgD</url>
            <title>Stories by akshara on Medium</title>
            <link>https://medium.com/@cutepandaakhi717?source=rss-884004e62eee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:03:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cutepandaakhi717/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[Python: Strings]]></title>
            <link>https://medium.com/@cutepandaakhi717/python-strings-a156624c3a69?source=rss-884004e62eee------2</link>
            <guid isPermaLink="false">https://medium.com/p/a156624c3a69</guid>
            <category><![CDATA[string-methods]]></category>
            <category><![CDATA[python-strings]]></category>
            <dc:creator><![CDATA[akshara]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 17:44:01 GMT</pubDate>
            <atom:updated>2026-11-16T17:44:01.407Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is a String?</strong></h3><p>A string is a built-in data type in Python that represents a sequence of characters enclosed within single quotes (‘ ‘), double quotes (“ “), or triple quotes (‘’’ ‘’’or &quot;”&quot; “””). It is used to store and manipulate textual data such as words, sentences, symbols, and numbers represented as text.</p><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*o9KBaNIjyfAO_O_xBiG-Uw.png" /><figcaption>Example of a string</figcaption></figure><h3>Properties of a String in Python</h3><ol><li><strong>Ordered:</strong> A string is an ordered sequence of characters, where each character maintains a specific position.</li><li><strong>Immutable:</strong> Once a string is created, its characters cannot be modified, replaced, or deleted directly.</li><li><strong>Indexed:</strong> Every character in a string is assigned an index position. Python supports both positive indexing (starting from 0) and negative indexing (starting from -1).</li><li><strong>Iterable:</strong> A string is iterable, which means its characters can be accessed one by one using loops.</li><li><strong>Allows Duplicate Characters:</strong> A string can contain repeated characters without any restrictions.</li><li><strong>Supports Slicing:</strong> A string allows extracting a specific portion of characters using slicing.</li><li><strong>Heterogeneous Character Support:</strong> A string can contain alphabets, digits, special symbols, spaces, and Unicode characters together.</li><li><strong>Supports Concatenation:</strong> Two or more strings can be combined using the ‘+’ operator.</li><li><strong>Supports Repetition:</strong> A string can be repeated multiple times using the ‘*’ operator.</li><li><strong>Length Determinable:</strong> The total number of characters in a string can be determined using the built-in len() function.</li></ol><p><strong>Note:</strong> Strings are ordered and immutable sequences of characters, meaning their characters can be accessed individually but cannot be modified directly after the string is created.</p><p><strong>How to access character or sequence of characters in a string?</strong></p><p>python provides two techniques to access elements of a string:</p><ol><li>Indexing</li><li>Slicing</li></ol><p><strong>Indexing</strong> — It is a technique used to access an individual character in a string by using its corresponding index value.</p><ul><li><strong>Index Value</strong> — Every character in a string is assigned a unique index position. Python supports two types of indexing: positive indexing, which starts from 0 (left to right), and negative indexing, which starts from -1 (right to left).</li></ul><p>Syntax:</p><ul><li>string or variable [index value]</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*mMQf9VQ44gOlaFme7OjSkg.png" /><figcaption>Examples of String Indexing</figcaption></figure><p><strong>Slicing — </strong>It is a technique used to access a specific sequence of characters from a string by specifying the starting index, ending index, and optional step value. It allows us to extract a portion of a string based on the given index positions.</p><p>Syntax:</p><ul><li>string or variable [start index: end index: step size]</li></ul><p>Slicing in Python can be classified into three types based on the index values used:</p><ol><li><strong>Positive Slicing</strong> — Slicing performed using positive index value</li><li><strong>Negative Slicing</strong> — Slicing performed using negative index values.</li><li><strong>Mixed Slicing</strong> — Slicing performed using a combination of positive and negative index values.</li></ol><p><strong>Positive Slicing: </strong>It is a technique used to extract a sequence of characters from a string by using positive index values. It allows us to access characters from left to right by specifying the starting index, ending index, and optional step value. The positive step value (1) indicates that the slicing operation moves in the forward direction (left to right).</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*93nXWwxZYci6z4BdbUoagg.png" /><figcaption>Examples of Positive Slicing</figcaption></figure><p><strong>Negative slicing: </strong>It is a technique used to extract a sequence of characters from a string by using negative index values. It allows us to access characters from right to left by specifying the starting index, ending index, and step value. The negative step value (-1) indicates that the slicing operation moves in the reverse direction (right to left).</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*YyUFafJbdmOy4RfL1BsCfw.png" /><figcaption>Examples of Negative Slicing</figcaption></figure><p><strong>Mixed Slicing: </strong>It is a technique used to extract a sequence of characters from a string by using a combination of positive and negative index values. It allows us to access characters by specifying the starting index, ending index, and optional step value. The direction of slicing depends on the step value, which determines whether the characters are accessed from left to right or right to left.</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*3GQlMdkOMErp6n8TRXs5_Q.png" /><figcaption>Examples of Mixed Slicing</figcaption></figure><h3><strong>String Methods:</strong></h3><p>To access, manipulate, and perform various operations on string elements in Python, we use a set of built-in methods known as <strong>String Methods</strong>, which are specifically designed to work with string data.</p><ol><li>upper(): It is a built-in string method which is used to convert all the lowercase alphabets to uppercase alphabets, rest of the characters will be ignored.</li></ol><p>Syntax:</p><ul><li>string or variable. upper()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*RqGft7ZwRnNge1EIMdvhrA.png" /><figcaption>Examples of upper() string method</figcaption></figure><p>2. lower(): It is a built-in string method which is used to convert all the uppercase alphabets to lowercase alphabets, rest of the characters will be ignored.</p><p>Syntax:</p><ul><li>string or variable. lower()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*SxjBCUBpvt5KLnFU4dqJDA.png" /><figcaption>Examples of lower() string method</figcaption></figure><p>3. swapcase(): It is a built-in string method which is used to convert all the uppercase alphabets to lowercase alphabets and lowercase alphabets to uppercase alphabets, rest of the characters will be ignored.</p><p>Syntax:</p><ul><li>string or variable. swapcase()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*egExXyzu266xduIbhjTNMA.png" /><figcaption>Examples of swapcase() string method</figcaption></figure><p>4. capitalize (): It is a built-in string method used to convert the first character of a string to uppercase and the remaining characters to lowercase. If the first character is a number or a special symbol, it remains unchanged, while the rest of the characters are converted to lowercase.</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*5iVM2Y6PH5Wsn0JVe2AIXg.png" /><figcaption>Examples of capitalize() string method</figcaption></figure><p>5. title (): It is a built-in string method used to convert the first character of each word in a string to uppercase and the remaining characters of each word to lowercase. It returns the modified string without changing the original string.</p><p>In python, word is identified as a sequence of alphabets.</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*NZb07rBe_YrJXz4shMrz-g.png" /><figcaption>Examples of title() string method</figcaption></figure><p>6. count(): It is a built-in string method used to count the number of occurrences of a specified substring within a given string. It returns an integer value representing the total number of occurrences without modifying the original string.</p><p>Syntax:</p><p>string or variable.count(‘substring’)</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*NPOr-0hKKWS4L9e_ljgfQg.png" /><figcaption>Examples of count() string method</figcaption></figure><ul><li>count() method also provides an option for searching only from specific positions using start index and end index.</li></ul><p>Syntax:</p><p>string or variable.count(“substring”,start index,end index)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSmo6Iv1sen_JJuZ-QnEFQ.png" /><figcaption>Examples of count with additional option</figcaption></figure><p>7. index(): It is a built-in string method used to return the index position of the first occurrence of a specified character or substring within a given string. If the specified character or substring is not found, it raises a <strong>ValueError</strong>.</p><p>Syntax:</p><p>string or variable. index(“substring”) or</p><p>string or variable. index(“substring”, start index, end index)</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*nyZ1mvoOIseTjsZxanxSww.png" /><figcaption>Examples of index() method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*j10RNT3WDPUjgBRwYokiRg.png" /><figcaption>Example of a ValueError-when we try to find the index of a substring which is not present in main string</figcaption></figure><p>8. find(): It is a built-in string method used to return the index position of the first occurrence of a specified character or substring within a given string. If the specified character or substring is not found, it returns a -1.</p><ul><li>string or variable. find(“substring”) or</li><li>string or variable. find(“substring”, start index, end index)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*A9MCn-3qVz_zFVzZQDVWkw.png" /><figcaption>Examples of find() method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*LrmFyl3ybKIcoSTTyog_Zw.png" /><figcaption>Example of find () method returning -1 if the substring is not found</figcaption></figure><p>9. rindex(): It is a built-in string method used to return the index position of the last occurrence of a specified character or substring within a given string. If the specified character or substring is not found, it raises a ValueError.</p><p>The rindex() method searches the string in the reverse direction (right to left), but the index value it returns is based on the original string indexing, which starts from 0 on the left side.</p><ul><li>string or variable. rindex(“substring”) or</li><li>string or variable. rindex(“substring”, start index, end index)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*0tK8xGfW46IROqWhdPhjfw.png" /><figcaption>Examples of rindex() method</figcaption></figure><p>10. rfind(): It is a built-in string method used to return the index position of the last occurrence of a specified character or substring within a given string. If the specified character or substring is not found, it returns -1 instead of raising an error.</p><p>The rfind() method searches the string in the reverse direction (right to left), but the index value it returns is based on the original string indexing, which starts from 0 on the left side.</p><p>Syntax:</p><ul><li>string or variable. rfind(“substring”) or</li><li>string or variable. rfind(“substring”, start index, end index)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*DUXawB4eYJDQyzZUZg1jfA.png" /><figcaption>Examples of rfind() method</figcaption></figure><p><strong>Note: </strong>The working of both index( )and find( ) methods is similar. However, the key difference arises when the specified character or substring is not found in the given string. In such cases, the iindex( ) method raises a ValueError, whereas the find() method returns -1. The same difference applies to the rindex( ) and rfind( ) methods, which search for the last occurrence of the specified character or substring.</p><p>11. strip(): It is a built-in string method used to remove specified characters from the beginning (left side) and ending (right side) of a string. If no characters are specified, it removes leading and trailing whitespace characters by default. It returns a new string without modifying the original string.</p><p>Syntax:</p><ul><li>string or variable. strip(“substring”)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8NtCQkOv_6Ak6dsTqOOD_A.png" /><figcaption>Examples of strip() method</figcaption></figure><p>12. lstrip(): It is a built-in string method used to remove specified characters from only the beginning (left side) of a string. If no characters are specified, it removes leading and trailing whitespace characters by default. It returns a new string without modifying the original string.</p><p>Syntax:</p><ul><li>string or variable. lstrip(“substring”)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xK9U1LbRLeLPrJwLkdcBPw.png" /><figcaption>Examples of lstrip() method</figcaption></figure><p>13. rstrip(): It is a built-in string method used to remove specified characters from only the ending (right side) of a string. If no characters are specified, it removes leading and trailing whitespace characters by default. It returns a new string without modifying the original string.</p><p>Syntax:</p><ul><li>string or variable. rstrip(“substring”)</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpIl6ay2Dd50LSYa5XhVLw.png" /><figcaption>Examples of rstrip() method</figcaption></figure><p>14. split(): It is a built-in string method used to divide a string into multiple substrings based on the specified separator. It always returns the resulting substrings as a list. Always executes from left to right.</p><p>This method divides a string into separate parts based on the specified separator. It excludes the separator from the resulting substrings and returns the parts as a list. Each split operation separates the string into the portion before and after the separator.</p><p>The split() method also allows us to limit the number of splits performed on a string by specifying the maximum number of splits.</p><p>Syntax:</p><ul><li>string or variable. split(“substring”, maxsplit(optional))</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*ydyuV_xTsagTuWPMpUWSHA.png" /><figcaption>Examples of split() method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*8wFeu-abw7TMa5LTVKgX4g.png" /><figcaption>Example of maxsplit option with split() method</figcaption></figure><p>15. rsplit(): It is a built-in string method used to split a string into multiple substrings based on the specified separator. Unlike the split () method, which splits the string from left to right, rsplit () performs the splitting operation from right to left. It excludes the separator from the resulting substrings and always returns them as a list. It also allows us to limit the number of splits using the maxsplit parameter.</p><p>Syntax:</p><ul><li>string or variable. rsplit(“substring”, maxsplit(optional))</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*cTDVq3wI1w40dhm52Wrqpw.png" /><figcaption>Examples of rsplit() method</figcaption></figure><p>16. replace(): It is a built-in string method used to replace a specified character or sequence of characters with another character or sequence of characters.</p><p>There is no restriction on the length of the old and new substrings. We can replace a single character with multiple characters, multiple characters with a single character, or sequences of different lengths.</p><p>The replace() method always returns a new string without modifying the original string, as strings are immutable in Python.</p><p><strong>Syntax:</strong></p><ul><li>string or variable.replace(old,new)</li><li>old: The character or substring that needs to be replaced.</li><li>new: The character or substring that replaces the old value.</li></ul><p><strong>Note:</strong> The method also accepts an optional count parameter to specify the maximum number of replacements.</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*mBkg4TB4-mfsSj17IW1uCw.png" /><figcaption>Examples of replace() method</figcaption></figure><p>17. isupper() : It is a built-in string method used to check whether all the alphabetic characters in a string are in uppercase. It returns True if all the alphabetic characters are uppercase and at least one alphabetic character is present; otherwise, it returns False.</p><p><strong>Syntax:</strong></p><ul><li>string or variable.isupper()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*R37yQsK4e1P3ARV_jQZX0w.png" /><figcaption>Examples of isupper() method</figcaption></figure><p>18. islower(): It is a built-in string method used to check whether all the alphabetic characters in a string are in lowercase. It returns True if all the alphabetic characters are lowercase and at least one alphabetic character is present; otherwise, it returns False.</p><p><strong>Syntax:</strong></p><ul><li>string or variable.islower()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*4xILFeyaGjK0UrVn58G38A.png" /><figcaption>Examples of islower() method</figcaption></figure><p>19. istitle(): It is a built-in string method used to check whether a string follows title case. It returns True if the first character of each word is uppercase and the remaining cased characters are lowercase. Otherwise, it returns False.</p><p><strong>Syntax:</strong></p><ul><li>string or variable.istitle()</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*EBgen7be1rN9rm7MBR66Vw.png" /><figcaption>Examples of istitle() method</figcaption></figure><p>20. isdigit(): It is a built-in string method used to check whether all the characters in a string are digits. It returns True if the string contains only digit characters and has at least one character; otherwise, it returns False.</p><p>Syntax:</p><ul><li>string or variable.isdigit( )</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*rgkzlKYocz2XuimRIGcvJg.png" /><figcaption>Examples of isdigit() method</figcaption></figure><p>21. isalpha(): It is a built-in string method used to check whether all the characters in a string are alphabetic letters. It returns True if the string contains only alphabetic characters and has at least one character; otherwise, it returns False.</p><p>Syntax:</p><ul><li>string or variable.isalpha( )</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*u4TzdkdvCBDgDVBdb4N3iw.png" /><figcaption>Examples of isalpha() method</figcaption></figure><p>22. isalnum(): It is a built-in string method used to check whether all the characters in a string are either alphabetic letters or numeric digits. It returns True if the string contains only letters and digits, with at least one character; otherwise, it returns False.</p><p>Syntax:</p><ul><li>string or variable.isalnum( )</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*2VxkMGNFNhDMLNwtdQkuyg.png" /><figcaption>Examples of isalnum() method</figcaption></figure><p>23. isspace(): It is a built-in string method used to check whether all the characters in a string are whitespace characters, such as spaces, tabs, and newline characters. It returns True if the string contains only whitespace characters and has at least one character; otherwise, it returns False.</p><p>Syntax:</p><ul><li>string or variable.isspace( )</li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*XD7-i03n90TqXEHRZbObgA.png" /><figcaption>Examples of isspace() method</figcaption></figure><p>25. isidentifier(): It is a built-in string method used to check whether a string is a valid Python identifier (a name used for variables, functions, classes, etc.). It returns True if the string follows Python&#39;s identifier naming rules; otherwise, it returns False.</p><p>Syntax:</p><ul><li>string or variable.isidentifier( )</li></ul><p><strong>Note:</strong> A valid identifier can contain letters, digits (but cannot start with a digit), and underscores. It cannot contain spaces or special characters, and it must not be a Python keyword</p><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*Vn18CZCL5_kuFbREd8Ar2Q.png" /><figcaption>Examples of isidentifier() method</figcaption></figure><h3>Conclusion</h3><p>Python string methods make it easier to perform various operations on strings, such as modifying, searching, splitting, replacing, and checking characters. Since strings are immutable in Python, most string methods return a new string without changing the original one. Understanding these methods helps us handle and manipulate text efficiently, making string operations an essential part of Python programming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a156624c3a69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: Type Conversion]]></title>
            <link>https://medium.com/@cutepandaakhi717/python-type-conversion-3071d970e004?source=rss-884004e62eee------2</link>
            <guid isPermaLink="false">https://medium.com/p/3071d970e004</guid>
            <category><![CDATA[type-conversion-in-python]]></category>
            <dc:creator><![CDATA[akshara]]></dc:creator>
            <pubDate>Sat, 14 Nov 2026 15:26:43 GMT</pubDate>
            <atom:updated>2026-11-14T15:26:43.548Z</atom:updated>
            <content:encoded><![CDATA[<p>Python supports various types of data, each designed to represent and handle specific kinds of values. These categories of data are known as <strong>“Data Types”</strong> in Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*hL9f6495uS8F0bvxTSGo9A.jpeg" /><figcaption>List of python data types</figcaption></figure><h3><strong>Type Conversions:</strong></h3><p>Type conversion is a technique used to convert a value from one data type to another data type in Python.</p><p>Example: Int ← → Float</p><p>There are two types of type conversions in python-</p><ol><li>Implicit type conversion</li><li>Explicit type conversion</li></ol><p><strong>1)Implicit type conversion:</strong></p><p>It is a type conversion technique in which the Python engine automatically converts one data type into another based on the precedence rules.</p><p><strong>Note:</strong> In this type of conversion, there is no loss of data, as Python follows the data type precedence rules to ensure safe conversion.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/121/1*fDEXxGfVDUYYPs7VV7Bdzw.png" /><figcaption>Example of implicit type conversion</figcaption></figure><p>In the above example, we are trying to add a float value (3.56) and an integer value (10), which belong to two different data types. In this case, the Python engine performs <strong>implicit type conversion</strong> based on the data type precedence rules. Since the float data type has higher precedence than the integer data type, Python automatically converts the integer value (10) into a float value (10.0). It then adds the converted value (10.0) to the float value (3.56) and returns the result as 13.56, which is also a float value. As we can observe, the conversion takes place automatically without losing the fractional precision of the given float value.</p><p><strong>2) Explicit type conversion:</strong></p><p>It is a type conversion technique in which the programmer explicitly converts a value from one data type to another based on their requirements.</p><p>Python provides built-in constructors for different data types, which allow programmers to convert values from one data type to another.</p><p><strong>Note:</strong> There is a possibility of data loss during explicit type conversion, as the programmer manually converts values from one data type to another without considering whether any information or precision might be lost.</p><p>Python provides built-in constructors for each data type to perform these conversions.</p><p>Even built-in constructors follow certain conversion rules when converting values from one data type to another.</p><p>For example, the int() constructor converts a float or integer value into an integer. However, it cannot directly convert a complex number into an integer and raises a TypeError instead.</p><p><strong>Some of the constructors are as follows:</strong></p><p><strong>int()</strong>-It is a built-in constructor belonging to the numeric group, which is used to convert float or integer values into the integer data type.</p><p>Example: int(4.3) returns 4 #the precise value 0.3 is lost here</p><p><strong>float()</strong> — It is a built-in constructor belonging to the numeric group, which is used to convert integer or float values into the float data type.</p><p>Example: float(45) returns 45.0 #a float value</p><p><strong>complex()</strong> — It is a built-in constructor belonging to the numeric group, which is used to convert integer, float, or complex values into complex data type values.</p><p>Examples: complex(32) returns (32+0j); complex(2.8) returns (2.8+0j)</p><p><strong>str()</strong> — It is a built-in constructor used to convert values of different data types, such as integer, float, and complex, into string (textual) data. It can also accept an existing string value and return it as a string.</p><p>Examples: str(10) returns ‘10’; str(7.5+2j) returns ‘(7.5+2j)’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*cCixfdVyD2Cxiz0JeTN3hg.png" /><figcaption>Example of string constructor applying on different data types</figcaption></figure><p><strong>range()</strong> — It is a built-in constructor used to generate a sequence of integers within a specified range. It is commonly used in loops and supports start, stop, and step parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/147/1*EpjMdOnKQ9lXz__TKhkitg.png" /><figcaption>example of a range constructor</figcaption></figure><p><strong>bool()</strong> — It is a built-in constructor used to convert a given value into a Boolean data type, returning either True or False.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/109/1*lYw8QMyhn2GTXynhC8z8Hg.png" /><figcaption>Example of boolean constructor</figcaption></figure><p><strong>Collection data type constructors:</strong></p><p><strong>list()</strong> — It is a built-in constructor used to create a list from an iterable object, such as a string, tuple, set, dictionary, or range. It can also create an empty list when no argument is provided.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*iO5K1I2QRfVWPbJ-kfbgLQ.png" /><figcaption>Examples of list constructor</figcaption></figure><p><strong>tuple()</strong> — It is a built-in constructor used to create a tuple from an iterable object, such as a list, string, set, dictionary, or range. It can also create an empty tuple when no argument is provided.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*chGKoq3Aw0o08yB2hh3RrQ.png" /><figcaption>Examples of tuple constructor</figcaption></figure><p><strong>set()</strong> — It is a built-in constructor used to create a set from an iterable object, such as a list, tuple, string, or range. It stores only unique elements and removes duplicate values.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*Dviv5Um6A0uB2kZkaiSqsQ.png" /><figcaption>Examples of set constructor</figcaption></figure><p><strong>frozenset()</strong> — It is a built-in constructor used to create an immutable set from an iterable object, such as a list, tuple, set, or string.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*zjowAbcESEPv5M4MlEUHnw.png" /><figcaption>Examples of frozen set constructor</figcaption></figure><p><strong>dict()</strong> — It is a built-in constructor used to create a dictionary containing key-value pairs. It can construct a dictionary from another dictionary or an iterable containing key-value pairs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*z702KU55obqs7qRuGTtkJw.png" /><figcaption>Example of a dict() constructor</figcaption></figure><p><strong>Note:</strong> Not every constructor accepts every data type as input. Each constructor has its own conversion rules and restrictions. Some conversions may also result in data loss or raise a <strong>TypeError </strong>or<strong> ValueError</strong>.</p><p><strong>TypeError: </strong>A TypeError occurs when an operation or function is applied to a value of an inappropriate data type or when incompatible data types are used in an operation.</p><p><strong>Example:</strong> Trying to convert a complex number directly into an integer using the int() constructor raises a TypeError in Python.</p><p><strong>ValueError: </strong>A ValueError occurs when a function or constructor receives an argument of the correct data type but an inappropriate or invalid value that it cannot process.</p><p><strong>Example: </strong>Trying to convert a string into an integer using int constructor</p><h3>Conclusion</h3><p>Python provides a wide range of built-in constructors that allow programmers to convert values from one data type to another based on their requirements. Each constructor has its own functionality and conversion rules. Understanding these constructors, their supported data types, and their limitations helps programmers perform type conversions effectively while avoiding unexpected errors and data loss.</p><p><strong>Remember, understanding type conversion is not just about changing the data type; it is about knowing how Python handles and interprets different types of data.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3071d970e004" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Python Syntax]]></title>
            <link>https://medium.com/@cutepandaakhi717/understanding-python-syntax-a5145ffe18e2?source=rss-884004e62eee------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5145ffe18e2</guid>
            <category><![CDATA[python-synatx]]></category>
            <dc:creator><![CDATA[akshara]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 19:51:25 GMT</pubDate>
            <atom:updated>2026-11-12T19:51:25.723Z</atom:updated>
            <content:encoded><![CDATA[<p>Python syntax refers to the set of rules and guidelines that a programmer or developer must follow while writing code in the Python programming language. Every programming language has its own syntax rules. If a programmer fails to follow these rules, Python raises a SyntaxError.</p><p><strong>Syntax Error:</strong></p><p>A syntax error occurs whenever a programmer violates the syntax rules of Python while writing code. In such cases, Python detects the error during the syntax checking process and raises an error called SyntaxError, preventing the program from executing successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*JgJbLJmIAkqbzBqsIg8K5w.png" /><figcaption>syntax error</figcaption></figure><p>To understand Python syntax and its different types, we must first understand the basic concept of a “Statement” in Python.</p><h3>Statement:</h3><p>A set of instructions which can be executed by the python engine with errors or without errors is called statement.</p><p><strong>Rules of writing a statement:</strong></p><p>There are especially 3 statement rules:</p><ol><li><strong>Writing a single statement in single line</strong></li></ol><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/142/1*U9yVWXlptZG8c4QJvD3P0Q.png" /><figcaption>example for writing a single statement in single line</figcaption></figure><p><strong>2. Writing multiple statements in single line</strong>- python allows us to write multiple statements in single line by using a symbol ‘;’.</p><p><strong>Note</strong>: Never place a ‘;’ at the end of the statement as the compiler assumes that the statement of other statement to be present.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*SA0wmGWYfegIQtiSZoTChQ.png" /><figcaption>example for writing multiple statements in single line</figcaption></figure><p><strong>3. Writing single statement in multiple lines</strong>- python also allow us to write single statement in multiple lines by using two symbols-’\’ and ‘( )’. wherever you want to break or split the statement use the ‘\’.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*LzqFC8Eq01la_c3LdMWJnQ.png" /><figcaption>example for writing single statement in multiple lines</figcaption></figure><p>Note: Never place a “\” at the end of the statement as the compiler assumes that the statement has another value and raises an exception called as ”IncompleteInputError”.</p><ul><li>This is also called as <strong>line continuation</strong>.</li></ul><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*H7wE8B06NQs-k6Y58tkIWA.png" /><figcaption>example of “IncompleteInputError”</figcaption></figure><p>We can also use ‘( )’-This is the most convenient and preferable way to write single statement in multiple lines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*AXHKNklU-q0OUV29AlIPMA.png" /></figure><h3>Comments:</h3><p>A set of instructions which can’t be executed by the python engine is called comment. A comment can be represented in python by using a symbol ‘#’. A ‘#’ should always to be included at the beginning of the comment line. Note: Python only supports single line comment but we can implement multi-line comment by using ‘#’ multiple times.</p><ul><li><strong>statement ← ‘#’ → comment</strong></li></ul><p>Examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*CqxJ3f1lmONj7RbFtwVxxA.png" /><figcaption>example of a “single line comment”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*soZyfv4jj9nzaKKtT4GxsA.png" /><figcaption>example of a “multi-line comment”</figcaption></figure><h3>Keywords:</h3><p>They are the reserved words which has a special meaning in python engine. These words are unique and cannot be used as a variable name.</p><p>In the latest version of python 3.15.2 there are 35 keywords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/1*jyEMrPGkFRWgkSsNa4jHuA.png" /><figcaption>List of some keywords in python</figcaption></figure><h3>Variable:</h3><p>In simple terms variable is a temporary name given to a memory cell location to access the data stored in RAM.</p><p>It is a symbolic name that acts as a reference to an object or value stored in a memory.</p><p>Variables allow you to store, manipulate, and reuse data throughout your program.</p><p>Variables are mostly used when we have the requirement of reuse of data again and again.</p><p>Variable- create the data once, store once and use multiple times.</p><p><strong>Syntax for creating a variable:</strong></p><blockquote><strong>variable_name = Value</strong></blockquote><p>Example: a=10</p><p>In python we have a set of rules that need to be followed while creating a variable, which are knows as ‘<strong>Naming Convention’</strong>.</p><h4><strong>Naming Conventions:</strong></h4><ol><li>Variable name should always start with alphabet or “_” .</li></ol><p>Example: var=9, _=10,_girl=18</p><p>2. Variable name should not contain any special symbols or characters except ‘_’.</p><p>Example: va@=12 -not acceptable</p><p>3. Variable name can contain numbers, but not as first character.</p><p>Example: 1no=5, var123=34</p><p>4. Python is a case-sensitive programming language i.e., it treats the uppercase characters or words different from lowercase words and letters.</p><p>Example: HELLO,hello,Hello are considered differently by the python engine.</p><p>5. Never ever use a keyword as a variable name.</p><p>example: True=10,int=5 → not acceptable.</p><h3>Conclusion:</h3><p>Python syntax is more than just a set of rules; it is the foundation of writing clear, readable, and efficient code. Every programmer and developer must understand and follow these syntax rules to build reliable and well-structured applications. A small syntax error can interrupt the entire execution process, while a proper understanding of syntax helps developers write code with confidence and precision.</p><p><strong>Remember, mastering Python syntax is not just the first step in learning Python; it is the first step toward becoming a better programmer.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5145ffe18e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Internal Working of a Python Engine]]></title>
            <link>https://medium.com/@cutepandaakhi717/the-internal-working-of-a-python-engine-ac86baf01d21?source=rss-884004e62eee------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac86baf01d21</guid>
            <dc:creator><![CDATA[akshara]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 07:52:37 GMT</pubDate>
            <atom:updated>2026-11-12T07:52:37.877Z</atom:updated>
            <content:encoded><![CDATA[<p>To understand the term <strong>“Python Engine,”</strong> we first need to understand what Python is and what an engine does. So, let’s begin with a few basic questions.</p><h3>1. What is Python?</h3><p>Python is a high-level, object-oriented, and case-sensitive programming language known for its simple syntax, readability, and versatility.</p><p>Python is widely used in web development, data science, machine learning, artificial intelligence, and automation.</p><p>Python allows developers to write programs using simple, readable and easy to understand syntax which helps the programmers to develop efficient and optimized applications.</p><h3><strong>2.What is an Engine?</strong></h3><p>An engine is a system that consists of various components, each designed to perform a specific function, working together to achieve a common goal.</p><p>For example, a car engine consists of different components such as pistons, cylinders, a crankshaft, and spark plugs. Each component has its own functionality, and all these components work together to convert fuel into mechanical energy, which helps the car move.</p><p>Similarly, every engine has its own set of components and functionalities depending on its purpose. In the same way, a Python engine consists of different components that work together to process and execute Python code.</p><p>Now, let us understand the internal working of the Python engine and how its components work together to execute a Python program.</p><h3><strong>3.Architecture of a Python Engine:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/0*h6RxOUQXrZOkPJmt.png" /><figcaption>Architecture of a Python Programming language</figcaption></figure><p>The execution of a Python program mainly involves the following components:</p><ol><li>Source Code</li><li>Syntax Checker</li><li>Compiler</li><li>Bytecode</li><li>Python Virtual Machine (PVM)</li><li>Output</li></ol><p>Now, let us understand each of these components briefly to gain a clear understanding of the internal working of the Python engine.</p><h4>1. Source Code</h4><p>Source code is the set of instructions written by a programmer in a .py or .ipynb file. This code is written using a text editor, an IDE, or an environment such as IDLE.</p><p>example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*xqjQbuynWH2HCdlNlgxzcQ.png" /></figure><p>The source code serves as the starting point for the execution of a Python program.</p><h4><strong>2. Syntax Checker</strong></h4><p>The syntax checker is a part of the Python execution process that verifies whether the source code follows the grammar rules and syntax of the Python language.</p><p>It checks the code for syntax errors. If any syntax issue is found, Python raises a SyntaxError, and the program cannot proceed to the next stage of execution.</p><p>The syntax analysis process involves components such as the lexical analyzer and parser, which help identify and analyze the structure of the source code.</p><h4>3. Compiler</h4><p>The compiler is another important component of the Python execution process.</p><p>If the source code passes the syntax checking process, the compiler translates the source code into bytecode.</p><p>Bytecode is a low-level, platform-independent representation of Python code. It acts as an intermediate form between the original source code and its execution.</p><h4>4. Bytecode</h4><p>Bytecode acts as an intermediate language between Python source code and the execution process.</p><p>It consists of a set of instructions that can be understood and executed by the Python Virtual Machine (PVM).</p><p>Python may also store the compiled bytecode in .pyc files to improve the efficiency of subsequent program executions.</p><h4>5. Python Virtual Machine (PVM)</h4><p>The Python Virtual Machine (PVM) is the core component responsible for executing Python bytecode.</p><p>It reads and executes the bytecode instructions one by one. The PVM is responsible for carrying out the operations specified by the bytecode.</p><p>The execution process ultimately involves the CPU, which performs the underlying operations required to produce the program’s output.</p><h4>6. Output</h4><p>The output is the final result displayed on the screen after the successful execution of a Python program. It represents the result produced by the program based on the instructions provided by the programmer.</p><h3><strong>Complete Execution Process of the Python Engine</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*DkmApB3ODkjpGMlEIUdzZQ.png" /></figure><p>When a programmer writes Python source code and clicks the <strong>Run</strong> button, the execution process begins.</p><p>The Python engine first processes the source code through syntax analysis, which involves components such as the lexical analyzer and parser. These components check whether the programmer has followed the syntax and grammar rules of Python.</p><p>If any syntax error is detected, Python raises a SyntaxError, and the execution process is stopped.</p><p>If the source code is free from syntax errors, the compiler translates it into bytecode. This bytecode is then passed to the Python Virtual Machine (PVM).</p><p>The PVM reads and executes the bytecode instructions one by one. During this process, the underlying system and CPU perform the necessary operations to execute the program.</p><p>Finally, the program produces the expected output, which is displayed on the screen.</p><p>Thus, the overall execution flow of a Python program can be represented as:</p><p><strong>Source Code → Syntax Checking → Compilation → Bytecode → Python Virtual Machine (PVM) → CPU Execution → Output</strong></p><p>Understanding these components helps us gain a clear insight into how Python programs are processed and executed internally.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac86baf01d21" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>