<?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 Rohanshiyani on Medium]]></title>
        <description><![CDATA[Stories by Rohanshiyani on Medium]]></description>
        <link>https://medium.com/@rohanshiyani820?source=rss-846e515f4a0d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bgVcHEMxLQRu6Q5H</url>
            <title>Stories by Rohanshiyani on Medium</title>
            <link>https://medium.com/@rohanshiyani820?source=rss-846e515f4a0d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:43:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohanshiyani820/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[Chapter 6: Manipulating Strings]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-6-manipulating-strings-bd181dc93724?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd181dc93724</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 02:07:33 GMT</pubDate>
            <atom:updated>2025-07-11T02:07:33.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 6: Manipulating Strings</figcaption></figure><ul><li>Strings are how Python handles text data. They allow you to store, manipulate, and display words, sentences, or even paragraphs. Learning how to work with strings is essential for most programming tasks.</li></ul><h4><strong>What is a String?</strong></h4><ul><li>A <strong>string</strong> in Python is a sequence of characters enclosed in quotes (‘ or “).</li></ul><p><strong>Example :</strong></p><pre>greeting = &quot;Hello, World!&quot;<br>print(greeting)  # Output: Hello, World!</pre><h4><strong>Basic String Operations</strong></h4><p><strong>1 : Concatenation (Joining Strings)</strong></p><p>Use the <strong>+</strong> operator to combine strings.</p><pre>first_name = &quot;Rohan&quot;<br>last_name = &quot;Smith&quot;<br>full_name = first_name + &quot; &quot; + last_name<br>print(full_name)  # Output: Rohan Smith</pre><p><strong>2 : Repetition</strong></p><p>Use the <strong>* </strong>operator to repeat a string multiple times.</p><pre>echo = &quot;Hi! &quot; * 3<br>print(echo)  # Output: Hi! Hi! Hi!</pre><p><strong>3 : Length of a String</strong></p><p>Use the <strong>len()</strong> function to find the number of characters in a string.</p><pre>text = &quot;Python&quot;<br>print(len(text))  # Output: 6</pre><h4><strong>Accessing Characters in Strings</strong></h4><p>Strings are indexed, meaning you can access individual characters using their position.</p><ul><li>First character starts at index 0.</li><li>Negative indexes count from the end.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;Python&quot;<br>print(text[0])   # Output: P<br>print(text[-1])  # Output: n</pre><h4><strong>Slicing Strings</strong></h4><p>You can extract parts of a string using slicing: string[start:end] .</p><ul><li><strong>Start</strong>: The starting index (inclusive).</li><li><strong>End</strong>: The ending index (exclusive).</li></ul><p><strong>Example:</strong></p><pre>text = &quot;Hello, World!&quot;<br>print(text[0:5])  # Output: Hello<br>print(text[:5])   # Output: Hello (start is optional)<br>print(text[7:])   # Output: World! (end is optional)</pre><h4><strong>Changing Case</strong></h4><ul><li><strong>upper()</strong> : Converts to uppercase.</li><li><strong>lower()</strong> : Converts to lowercase.</li><li><strong>title()</strong> : Capitalizes the first letter of each word.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;python is fun&quot;<br>print(text.upper())   # Output: PYTHON IS FUN<br>print(text.lower())   # Output: python is fun<br>print(text.title())   # Output: Python Is Fun</pre><h4>Finding and Replacing Text</h4><ul><li><strong>find()</strong> : Returns the index of the first occurrence of a substring.</li><li><strong>replace()</strong> : Replaces one substring with another.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;I love Python&quot;<br>print(text.find(&quot;Python&quot;))    # Output: 7<br>print(text.replace(&quot;Python&quot;, &quot;coding&quot;))  # Output: I love coding</pre><h4><strong>Splitting and Joining Strings</strong></h4><ul><li><strong>split()</strong> : Breaks a string into a list based on a delimiter (default is a space).</li><li><strong>join()</strong> : Combines a list of strings into one string, with a specified delimiter.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;apple,banana,cherry&quot;<br>fruits = text.split(&quot;,&quot;)  # Splits the string by commas<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<br><br>joined_text = &quot; - &quot;.join(fruits)  # Joins with &quot; - &quot;<br>print(joined_text)  # Output: apple - banana - cherry</pre><h4>Checking String Content</h4><ul><li><strong>startswith()</strong> : Checks if the string starts with a specific substring.</li><li><strong>endswith()</strong> : Checks if the string ends with a specific substring.</li><li><strong>isalpha()</strong> : Checks if the string contains only letters.</li><li><strong>isdigit()</strong> : Checks if the string contains only digits.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;Python3&quot;<br>print(text.startswith(&quot;Py&quot;))   # Output: True<br>print(text.isalpha())          # Output: False (contains a digit)</pre><h4>Removing Unwanted Spaces</h4><ul><li><strong>strip()</strong> : Removes spaces from the beginning and end of the string.</li><li><strong>lstrip()</strong> : Removes spaces from the left side.</li><li><strong>rstrip()</strong> : Removes spaces from the right side.</li></ul><p><strong>Example:</strong></p><pre>text = &quot;  Hello, World!  &quot;<br>print(text.strip())   # Output: Hello, World!</pre><h4><strong>Escape Characters</strong></h4><p>Use a backslash ( \ ) for special characters:</p><ul><li><strong>\n</strong> : New line</li><li><strong>\t</strong> : Tab</li><li><strong>\\</strong> : Backslash</li></ul><p><strong>Example:</strong></p><pre>print(&quot;Hello\nWorld&quot;)  # Output: Hello (newline) World<br>print(&quot;Tab\tSpace&quot;)    # Output: Tab    Space</pre><h4>Why Learn String Manipulation?</h4><ul><li>Strings are everywhere in programming: user input, file names, messages, etc.</li><li>Being able to manipulate strings makes your programs more flexible and powerful.</li></ul><p>Mastering strings lets you communicate effectively with both your code and your users!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd181dc93724" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 5 : Dictionaries and Organizing Data]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-5-dictionaries-and-organizing-data-e6285c66cc6d?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6285c66cc6d</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 03:22:54 GMT</pubDate>
            <atom:updated>2024-12-27T03:22:54.715Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 5 : Dictionaries and Organizing Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 5 : Dictionaries and Organizing Data</figcaption></figure><ul><li>A <strong>dictionary</strong> in Python is a tool for storing and organizing data using a structure of <strong>key-value pairs</strong>. It’s like a real-world dictionary where you look up a word (key) to find its meaning (value).</li></ul><h3>Why Use Dictionaries?</h3><ul><li>To store data in a structured way.</li><li>To quickly look up values using keys.</li><li>To organize related information together.</li></ul><h3>Creating a Dictionary</h3><ul><li>Dictionaries are created using curly braces { } . Keys and values are separated by a colon : .</li></ul><p><strong>Example :</strong></p><pre># Example of a dictionary<br>person = {<br>    &quot;name&quot;: &quot;Rohan&quot;,<br>    &quot;age&quot;: 22,<br>    &quot;city&quot;: &quot;New York&quot;<br>}<br><br>print(person)  # Output: {&#39;name&#39;: &#39;Rohan&#39;, &#39;age&#39;: 22, &#39;city&#39;: &#39;New York&#39;}</pre><h3>Accessing Dictionary Values</h3><ul><li>You can access a value by referring to its key.</li></ul><p><strong>Example :</strong></p><pre>person = {&quot;name&quot;: &quot;Rohan&quot;, &quot;age&quot;: 22, &quot;city&quot;: &quot;New York&quot;}<br>print(person[&quot;name&quot;])  # Output: Rohan<br>print(person[&quot;age&quot;])   # Output: 22</pre><h3>Adding and Updating Items</h3><ul><li>To add a new key-value pair, use the assignment operator =.</li><li>To update an existing value, assign a new value to its key.</li></ul><p><strong>Example :</strong></p><pre>person = {&quot;name&quot;: &quot;Rohan&quot;, &quot;age&quot;: 22}<br>person[&quot;city&quot;] = &quot;New York&quot;  # Adding a new key-value pair<br>print(person)  # Output: {&#39;name&#39;: &#39;Rohan&#39;, &#39;age&#39;: 22, &#39;city&#39;: &#39;New York&#39;}<br><br>person[&quot;age&quot;] = 26  # Updating an existing value<br>print(person)  # Output: {&#39;name&#39;: &#39;Rohan&#39;, &#39;age&#39;: 26, &#39;city&#39;: &#39;New York&#39;}</pre><h3>Removing Items</h3><ul><li><strong>Using pop() </strong>: Removes a key-value pair and returns the value.</li><li><strong>Using del </strong>: Deletes a key-value pair.</li></ul><p><strong>Example :</strong></p><pre>person = {&quot;name&quot;: &quot;Rohan&quot;, &quot;age&quot;: 22, &quot;city&quot;: &quot;New York&quot;}<br>person.pop(&quot;age&quot;)  # Removes the &#39;age&#39; key<br>print(person)  # Output: {&#39;name&#39;: &#39;Rohan&#39;, &#39;city&#39;: &#39;New York&#39;}<br><br>del person[&quot;city&quot;]  # Deletes the &#39;city&#39; key<br>print(person)  # Output: {&#39;name&#39;: &#39;Rohan&#39;}</pre><h3>Looping Through a Dictionary</h3><ol><li><strong>Keys :</strong></li></ol><pre>for key in person:<br>    print(key)</pre><p><strong>2. Values :</strong></p><pre>for value in person.values():<br>    print(value)</pre><p><strong>3. Key-Value Pairs :</strong></p><pre>for key, value in person.items():<br>    print(f&quot;{key}: {value}&quot;)</pre><h3>Checking for Keys</h3><ul><li>You can check if a key exists in a dictionary using the ‘in’ keyword.</li></ul><p><strong>Example :</strong></p><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25}<br>if &quot;name&quot; in person:<br>    print(&quot;Name is in the dictionary!&quot;)</pre><h3>Nested Dictionaries</h3><ul><li>Dictionaries can store other dictionaries, allowing for complex data structures.</li></ul><p><strong>Example :</strong></p><pre>students = {<br>    &quot;101&quot;: {&quot;name&quot;: &quot;Rohan&quot;, &quot;grade&quot;: &quot;A&quot;},<br>    &quot;102&quot;: {&quot;name&quot;: &quot;Kevil&quot;, &quot;grade&quot;: &quot;B&quot;}<br>}<br><br>print(students[&quot;101&quot;][&quot;name&quot;])  # Output: Rohan</pre><h3>Dictionary Functions</h3><ul><li>len() : Returns the number of key-value pairs.</li><li>keys() : Returns a list of all keys.</li><li>values() : Returns a list of all values.</li><li>items() : Returns a list of all key-value pairs.</li></ul><p><strong>Example :</strong></p><pre>person = {&quot;name&quot;: &quot;Rohan&quot;, &quot;age&quot;: 22}<br>print(len(person))          # Output: 2<br>print(person.keys())        # Output: dict_keys([&#39;name&#39;, &#39;age&#39;])<br>print(person.values())      # Output: dict_values([&#39;Rohan&#39;, 22])<br>print(person.items())       # Output: dict_items([(&#39;name&#39;, &#39;Rohan&#39;), (&#39;age&#39;, 22)])</pre><h3>Why Dictionaries are Important</h3><ul><li>They let you connect related information (e.g., name and age).</li><li>They are highly flexible and can store data of any type.</li><li>They are essential for managing more complex data structures and real-world problems.</li></ul><p>Dictionaries are like the backbone of organized data in Python — mastering them opens up a world of possibilities!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6285c66cc6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 4 : Lists]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-4-lists-03a731536abb?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/03a731536abb</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 03:09:53 GMT</pubDate>
            <atom:updated>2024-12-27T03:09:53.410Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 4 : Lists</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 4 : Lists</figcaption></figure><ul><li>A <strong>list</strong> in Python is a way to store multiple pieces of data in one place. It’s like a collection where you can group items, such as numbers, strings, or even other lists.</li></ul><h3>Why Use Lists?</h3><ul><li>To store multiple values in one variable.</li><li>To easily organize and access data.</li><li>To perform actions on groups of items, like sorting or adding up numbers.</li></ul><h3>Creating a List</h3><ul><li>Lists are created by placing items inside square brackets [ ], separated by commas.</li></ul><p><strong>Example :</strong></p><pre># A list of strings<br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br><br># A list of numbers<br>numbers = [1, 2, 3, 4, 5]<br><br># A mixed list<br>mixed = [1, &quot;hello&quot;, 3.5, True]</pre><h3>Accessing List Items</h3><ul><li>You can access items in a list using their <strong>index</strong>. Indexes start at 0.</li></ul><p><strong>Example :</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br><br>print(fruits[0])  # Output: apple<br>print(fruits[1])  # Output: banana<br>print(fruits[-1]) # Output: cherry (negative index counts from the end)</pre><h3>Modifying a List</h3><ul><li>You can change items in a list by using their index.</li></ul><p><strong>Example :</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>fruits[1] = &quot;blueberry&quot;<br><br>print(fruits)  # Output: [&#39;apple&#39;, &#39;blueberry&#39;, &#39;cherry&#39;]</pre><h3>Adding Items to a List</h3><ol><li><strong>Using append() </strong>: Adds an item to the end of the list.</li><li><strong>Using insert() </strong>: Adds an item at a specific position.</li></ol><p><strong>Example :</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;]<br>fruits.append(&quot;cherry&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<br><br>fruits.insert(1, &quot;blueberry&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;blueberry&#39;, &#39;banana&#39;, &#39;cherry&#39;]</pre><h3>Removing Items from a List</h3><ol><li><strong>Using remove() </strong>: Removes the first occurrence of the specified value.</li><li><strong>Using pop() </strong>: Removes an item at a specific index (default is the last item).</li><li><strong>Using del </strong>: Deletes an item or the entire list.</li></ol><p><strong>Example :</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>fruits.remove(&quot;banana&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;cherry&#39;]<br><br>fruits.pop(0)<br>print(fruits)  # Output: [&#39;cherry&#39;]<br><br>del fruits[0]<br>print(fruits)  # Output: []</pre><h3>Working with List Items</h3><ol><li>Looping Through a List :</li></ol><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>for fruit in fruits:<br>    print(fruit)</pre><p>2. Checking if an Item Exists :</p><pre>if &quot;banana&quot; in fruits:<br>    print(&quot;Yes, banana is in the list&quot;)</pre><h3>List Functions</h3><p>Python provides many built-in functions to work with lists:</p><ul><li>len() : Returns the number of items in the list.</li><li>sort() : Sorts the list.</li><li>reverse() : Reverses the list.</li><li>sum() : Adds up all the numbers in a list.</li></ul><p><strong>Example :</strong></p><pre>numbers = [3, 1, 4, 1, 5]<br>print(len(numbers))    # Output: 5<br>numbers.sort()<br>print(numbers)         # Output: [1, 1, 3, 4, 5]<br>numbers.reverse()<br>print(numbers)         # Output: [5, 4, 3, 1, 1]<br>print(sum(numbers))    # Output: 14</pre><h3>Why Lists are Important</h3><ul><li>They help you manage and process groups of data.</li><li>They are flexible and can grow or shrink as needed.</li><li>They are an essential building block for solving real-world problems in Python!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03a731536abb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 3 : Functions]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-3-functions-a83566bdc0e6?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a83566bdc0e6</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 02:32:51 GMT</pubDate>
            <atom:updated>2024-12-24T02:32:51.310Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 3 : Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 3 : Functions</figcaption></figure><ul><li>Functions are reusable blocks of code that perform a specific task. They make your code more organized, easier to read, and simpler to manage.</li></ul><h3>Why Use Functions?</h3><ul><li><strong>Reusability </strong>: Write the code once and use it multiple times.</li><li><strong>Organization </strong>: Break large programs into smaller, manageable pieces.</li><li><strong>Ease of Debugging </strong>: Debug smaller chunks of code instead of the entire program.</li></ul><h3>Creating a Function</h3><ul><li>To create a function in Python, use the <strong>def</strong> keyword, followed by the function name and parentheses <strong>( )</strong> .</li></ul><p>Syntax :</p><pre>def function_name():<br>    # Code to execute<br>    pass</pre><p>Example :</p><pre>def greet():<br>    print(&quot;Hello, welcome to Python!&quot;)<br>    <br>greet()  # This calls the function and prints the message</pre><h3>Functions with Parameters</h3><ul><li>Functions can accept data, called <strong>parameters</strong>, to work with.</li></ul><p><strong>Example :</strong></p><pre>def greet_user(name):<br>    print(f&quot;Hello, {name}!&quot;)<br><br>greet_user(&quot;Rohan&quot;)  # Output: Hello, Rohan!<br>greet_user(&quot;Python&quot;)    # Output: Hello, Python!</pre><h3>Functions with Return Values</h3><ul><li>Functions can send data back to the part of the program that called them using the <strong>return</strong> statement.</li></ul><p><strong>Example :</strong></p><pre>def add_numbers(a, b):<br>    return a + b<br><br>result = add_numbers(3, 5)<br>print(result)  # Output: 8</pre><h3>Default Parameters</h3><ul><li>You can set default values for parameters, which are used if no value is provided when calling the function.</li></ul><p><strong>Example :</strong></p><pre>def greet(name=&quot;Guest&quot;):<br>    print(f&quot;Hello, {name}!&quot;)<br><br>greet(&quot;Rohan&quot;)  # Output: Hello, Rohan!<br>greet()         # Output: Hello, Guest!</pre><h3>Keyword Arguments</h3><ul><li>When calling a function, you can specify arguments by their names, making the code more readable.</li></ul><p><strong>Example :</strong></p><pre>def display_info(name, age):<br>    print(f&quot;Name: {name}, Age: {age}&quot;)<br><br>display_info(age=22, name=&quot;Rohan&quot;)  # Output: Name: Rohan, Age: 22</pre><h3>Variable Scope</h3><ul><li><strong>Local Variables </strong>: Variables defined inside a function are only accessible within that function.</li><li><strong>Global Variables </strong>: Variables defined outside all functions can be accessed anywhere.</li></ul><p><strong>Example :</strong></p><pre>x = 10  # Global variable<br><br>def show_number():<br>    x = 5  # Local variable<br>    print(f&quot;Local x: {x}&quot;)<br><br>show_number()  # Output: Local x: 5<br>print(f&quot;Global x: {x}&quot;)  # Output: Global x: 10</pre><h3>Why Functions are Important</h3><ul><li>They reduce repetition in your code.</li><li>They make your programs easier to read and maintain.</li><li>They allow you to focus on smaller, specific tasks while coding.</li></ul><p><strong>Functions are like tools in a toolbox — master them, and you can solve any problem more efficiently! 🎉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a83566bdc0e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 2 : Flow Control]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-2-flow-control-e5cc0c39481c?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5cc0c39481c</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 02:35:41 GMT</pubDate>
            <atom:updated>2024-12-23T02:48:52.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 2 : Flow Control</figcaption></figure><ul><li>Flow control helps your program make decisions and execute different instructions depending on the situation. It’s like teaching your program how to think logically.</li></ul><h3><strong>Key Concepts in Flow Control</strong></h3><h3><strong>1. if , elif, and else Statements</strong></h3><ul><li>These statements allow your program to choose what to do based on a condition.</li></ul><p><strong>Example :</strong></p><pre>temperature = 25<br><br>if temperature &gt; 30:<br>    print(&quot;It&#39;s hot outside!&quot;)<br>elif temperature &gt; 20:<br>    print(&quot;It&#39;s a nice day!&quot;)<br>else:<br>    print(&quot;It&#39;s cold outside!&quot;)</pre><p><strong>How it works:</strong></p><ul><li>If the condition in the “ if ” is true, it runs that block of code.</li><li>If the first condition is false, it checks the “ <strong>elif </strong>” (else-if) condition.</li><li>If none of the conditions are true, the “ <strong>else </strong>” block runs.</li></ul><h3><strong>2. Comparison Operators</strong></h3><p>Use these to compare values in your conditions:</p><ul><li>“ <strong>&gt;</strong> ” (greater than)</li><li>“ <strong>&lt;</strong> ” (less than)</li><li>“ <strong>≥</strong> ” (greater than or equal to)</li><li>“ <strong>≤</strong> ” (less than or equal to)</li><li>“ <strong>==</strong> ” (equal to)</li><li>“ <strong>!=</strong> ” (not equal to)</li></ul><p><strong>Example :</strong></p><pre>age = 18<br><br>if age &gt;= 18:<br>    print(&quot;You can vote!&quot;)<br>else:<br>    print(&quot;You are too young to vote.&quot;)</pre><h3><strong>3. Logical Operators</strong></h3><p>Combine conditions using:</p><ul><li>“ <strong>AND</strong> ” : All conditions must be true.</li><li>“ <strong>OR</strong> ” : At least one condition must be true.</li><li>“ <strong>NOT</strong> ” : Reverses the condition.</li></ul><p><strong>Example :</strong></p><pre>is_raining = True<br>has_umbrella = False<br><br>if is_raining and not has_umbrella:<br>    print(&quot;Stay inside!&quot;)<br>elif is_raining and has_umbrella:<br>    print(&quot;You can go outside.&quot;)<br>else:<br>    print(&quot;It&#39;s safe to go outside!&quot;)</pre><h3><strong>4. Loops</strong></h3><p>Loops repeat a block of code multiple times.</p><p><strong>for</strong> Loop :</p><p>Use it to iterate over a sequence (like a list or range of numbers).</p><pre>for number in range(1, 6):<br>    print(&quot;Number:&quot;, number)<br># Output: Number: 1, Number: 2, ..., Number: 5</pre><p><strong>while</strong> Loop :</p><p>Repeats as long as a condition is true.</p><pre>count = 0<br>while count &lt; 3:<br>    print(&quot;Count:&quot;, count)<br>    count += 1<br># Output: Count: 0, Count: 1, Count: 2</pre><h3><strong>Break and Continue</strong></h3><ul><li><strong>break</strong> : Exit the loop immediately.</li><li><strong>continue</strong> : Skip the rest of the loop and start the next iteration.</li></ul><p><strong>Example :</strong></p><pre>for number in range(5):<br>    if number == 3:<br>        break  # Stop the loop when number is 3<br>    print(number)<br><br>for number in range(5):<br>    if number == 2:<br>        continue  # Skip when number is 2<br>    print(number)</pre><h3><strong>Why Flow Control is Important</strong></h3><p>With flow control, your programs can:</p><ul><li>Make decisions based on user input or data.</li><li>React to different conditions.</li><li>Repeat tasks efficiently.</li></ul><p>Mastering flow control sets the foundation for writing smart, interactive programs!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5cc0c39481c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 1 : Python Basics]]></title>
            <link>https://medium.com/@rohanshiyani820/chapter-1-python-basics-4aa97d61ba28?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4aa97d61ba28</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 02:59:28 GMT</pubDate>
            <atom:updated>2024-12-24T02:33:15.171Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /><figcaption>Chapter 1: Python Basics</figcaption></figure><ul><li>Python is a beginner-friendly programming language that’s easy to learn and use. Let’s go over some of the key concepts to get started:</li></ul><h3><strong>What is Python?</strong></h3><ul><li>Python is a programming language used to create software, automate tasks, analyze data, and much more. It’s known for being simple and readable.</li></ul><h3>Python Interactive Shell</h3><ul><li>The Python Interactive Shell is a tool that lets you try Python code one line at a time. It’s great for experimenting and learning. To open it, type python in your terminal or command prompt.</li></ul><h3>Basic Concepts</h3><h3><strong>1. Expressions :</strong></h3><p>An expression is a piece of code that produces a value.</p><p>For example:</p><pre>2 + 2  # This adds two numbers and gives the result 4.</pre><h3><strong>2. Printing Output </strong>:</h3><p>You can use the print() function to display messages or results.</p><pre>print(&quot;Hello, Python!&quot;)  # This will show: Hello, Python!</pre><h3><strong>3. Variables :</strong></h3><p>A variable is a container for storing data.</p><pre>name = &quot;Rohan&quot;<br>age = 22<br>print(name, age)  # Output: Rohan 22</pre><h3><strong>4. Data Types :</strong></h3><p>Python works with different types of data:</p><ul><li><strong>Numbers</strong>: 10, 3.14</li><li><strong>Strings</strong>: &quot;Hello&quot;, &#39;Python&#39;</li><li><strong>Booleans</strong>: True, False</li></ul><h3><strong>5. Common Operations :</strong></h3><h4>Math Operations</h4><p>Python can handle basic math:</p><ul><li><strong>Addition</strong>: 2 + 3</li><li><strong>Subtraction</strong>: 5 - 2</li><li><strong>Multiplication</strong>: 3 * 4</li><li><strong>Division</strong>: 10 / 2</li></ul><pre>result = 10 + 5<br>print(result)  # Output: 15</pre><h3><strong>6. String Operations :</strong></h3><p>You can combine and repeat strings.</p><pre>greeting = &quot;Hello&quot; + &quot; Rohan&quot;<br>print(greeting)  # Output: Hello Rohan<br><br>repeat = &quot;Rohan &quot; * 3<br>print(repeat)  # Output: Rohan Rohan Rohan</pre><h3>How to Write Python Code</h3><ul><li>Open a text editor like VSCode or a Python IDE.</li><li>Write your Python code and save it as a .py file.<br>Example:</li></ul><pre>print(&quot;This is my first Python program!&quot;)</pre><ul><li>Run the file in your terminal :</li></ul><pre>python myfile.py</pre><h3>That’s the basics of Python! Practice these concepts, and you’ll be ready for more advanced topics. 🚀</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aa97d61ba28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn Python Beginner To Advanced]]></title>
            <link>https://medium.com/@rohanshiyani820/learn-python-beginner-to-advanced-83706f8b5fc4?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/83706f8b5fc4</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Thu, 19 Dec 2024 03:48:01 GMT</pubDate>
            <atom:updated>2024-12-20T02:22:07.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyIon5wCsI7vlRdsn2I94Q.png" /></figure><h3><strong>What is Python?</strong></h3><h3>Python is a general-purpose, high-level, interpreted programming language that’s used for a variety of tasks, including:</h3><ol><li><strong>Web development</strong>: Building websites and server-side web applications</li><li><strong>Software development</strong>: Rapid application development, bug tracking, and testing</li><li><strong>Data science and machine learning</strong>: Analyzing data and building machine learning models</li><li><strong>System scripting</strong>: Automating tasks like renaming files, updating shopping lists, and filling out forms</li><li><strong>Mathematics</strong>: Working with numbers and mathematical operations</li></ol><h3>Python is known for being:</h3><ol><li><strong>Easy to learn</strong>: Python is considered beginner-friendly and handles much of the complexity for the user</li><li><strong>Efficient</strong>: Python can run on many different platforms and increases development speed</li><li><strong>Versatile</strong>: Python can be used to create a variety of different programs</li><li><strong>Open-source</strong>: The Python community is constantly building new libraries and functionality</li></ol><h3><strong>Chapter 1: Python Basics</strong></h3><ul><li>Learn about expressions, the simplest kind of instruction in Python. Practice using the Python interactive shell to try out code.</li></ul><h3><strong>Chapter 2: Flow Control</strong></h3><ul><li>Understand how to make your programs choose what to do next. This helps your code react smartly to different situations.</li></ul><h3><strong>Chapter 3: Functions</strong></h3><ul><li>Discover how to create your own functions. Functions make your code easier to manage by breaking it into smaller parts.</li></ul><h3><strong>Chapter 4: Lists</strong></h3><ul><li>Introduces the list data type and explains how to organize data.</li></ul><h3><strong>Chapter 5: Dictionaries and Structuring Data</strong></h3><ul><li>Introduces the dictionary data type and shows you more powerful ways to organize data.</li></ul><h3><strong>Chapter 6: Manipulating Strings</strong></h3><ul><li>Covers working with text data (called <em>strings</em> in Python).</li></ul><h3><strong>Chapter 7: Pattern Matching with Regular Expressions</strong></h3><ul><li>Covers how Python can manipulate strings and search for text patterns with regular expressions.</li></ul><h3><strong>Chapter 8: Input Validation</strong></h3><ul><li>Explains how your program can verify the information a user gives it, ensuring that the user’s data arrives in a format that won’t cause errors in the rest of the program.</li></ul><h3><strong>Chapter 9: Reading and Writing Files</strong></h3><ul><li>Explains how your program can read the contents of text files and save information to files on your hard drive.</li></ul><h3><strong>Chapter 10: Organizing Files</strong></h3><ul><li>Shows how Python can copy, move, rename, and delete large numbers of files much faster than a human user can. Also explains compressing and decompressing files.</li></ul><h3><strong>Chapter 11: Debugging</strong></h3><ul><li>Shows how to use Python’s various bug-finding and bug-fixing tools.</li></ul><h3><strong>Chapter 12: Web Scraping</strong></h3><ul><li>Shows how to write programs that can automatically download web pages and parse them for information. This is called <em>web scraping</em>.</li></ul><h3><strong>Chapter 13: Working with Excel Spreadsheets</strong></h3><ul><li>Covers programmatically manipulating Excel spreadsheets so that you don’t have to read them. This is helpful when the number of documents you have to analyze is in the hundreds or thousands.</li></ul><h3><strong>Chapter 14: Working with Google Sheets</strong></h3><ul><li>Covers how to read and update Google Sheets, a popular web-based spreadsheet application, using Python.</li></ul><h3><strong>Chapter 15: Working with PDF and Word Documents</strong></h3><ul><li>Covers programmatically reading Word and PDF documents.</li></ul><h3><strong>Chapter 16: Working with CSV Files and JSON Data</strong></h3><ul><li>Continues to explain how to programmatically manipulate documents, now discussing CSV and JSON files.</li></ul><h3><strong>Chapter 17: Keeping Time, Scheduling Tasks, and Launching Programs</strong></h3><ul><li>Explains how Python programs handle time and dates and how to schedule your computer to perform tasks at certain times. Also shows how your Python programs can launch non-Python programs.</li></ul><h3><strong>Chapter 18: Sending Email and Text Messages</strong></h3><ul><li>Explains how to write programs that can send emails and text messages on your behalf.</li></ul><h3><strong>Chapter 19: Manipulating Images</strong></h3><ul><li>Explains how to programmatically manipulate images such as JPEG or PNG files.</li></ul><h3><strong>Chapter 20: Controlling the Keyboard and Mouse with GUI Automation</strong></h3><ul><li>Explains how to programmatically control the mouse and keyboard to automate clicks and keypresses.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83706f8b5fc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set Administrator Password in Frappe ERPNext Using Command and Database]]></title>
            <link>https://medium.com/@rohanshiyani820/set-password-in-frappe-erpnext-using-command-and-database-ff716f4a85c3?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff716f4a85c3</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 09:01:38 GMT</pubDate>
            <atom:updated>2024-10-09T12:44:09.087Z</atom:updated>
            <content:encoded><![CDATA[<h3>Option 1: Using the Command Line</h3><ol><li><strong>Open your terminal</strong> and navigate to your ERPNext installation directory, which is usually found at /frappe-bench or the name you have given to your bench.</li><li>Run the following command to open the Frappe Console:</li></ol><pre>bench --site your-site-name set-admin-password new-password</pre><p>Replace your-site-name with the name of your ERPNext site (e.g., site1.local) and new-password with the new password you want to set for the Administrator.</p><ul><li>Once the command is executed, the Administrator password will be updated.</li></ul><h3>Option 2: Using the ERPNext Web Interface</h3><ol><li><strong>Log in to your ERPNext account</strong> using your Administrator credentials.</li><li>Click on your <strong>profile icon</strong> in the top-right corner and go to <strong>“My Settings.”</strong></li><li>In the <strong>My Settings</strong> page, click on <strong>“Change Password”</strong>.</li><li>Enter the new password and confirm it, then click on <strong>“Save”</strong>.</li></ol><p>This method will allow you to change the Administrator password through the graphical interface.</p><h3>Option 3: Using Database Command (Last Resort)</h3><p>If you can’t access the ERPNext interface or the command line, you can reset the Administrator password directly from the database:</p><p>-&gt; Log in to your <strong>MariaDB</strong> or <strong>MySQL</strong> database:</p><pre>bench --site your-site-name mysql</pre><p>-&gt; Run the following SQL command to reset the password:</p><pre>UPDATE __Auth SET password=PASSWORD(&#39;new-password&#39;) WHERE user=&#39;Administrator&#39;;</pre><p>-&gt; Exit the database by typing:</p><pre>exit;</pre><p>This should change the password for the Administrator user directly in the database.</p><p>After following one of these methods, you should be able to log in with the new Administrator password.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff716f4a85c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Custom Fields and Property Setter in Frappe / ERPNext]]></title>
            <link>https://medium.com/@rohanshiyani820/adding-custom-fields-in-frappe-erpnext-7ffe5a5f214e?source=rss-846e515f4a0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ffe5a5f214e</guid>
            <dc:creator><![CDATA[Rohanshiyani]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 04:44:24 GMT</pubDate>
            <atom:updated>2024-10-09T08:36:46.059Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Create a folder named <strong>constants</strong> within your module.</li><li>Inside the <strong>constants</strong> folder, add a file named <strong>custom_fields.py</strong>.</li><li>This is how your folder structure should look:</li></ol><p><strong>/module</strong></p><p><strong>/constants</strong></p><p><strong>custom_fields.py</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/0*Qk-v-BFY-XhMKVR2" /></figure><ul><li>In the <strong>custom_fields.py</strong> file, you should define the custom fields for your DocType by specifying attributes like fieldname, label, fieldtype, and other properties. Here’s an example of how to structure your fields in the file for a specific DocType:</li></ul><blockquote>custom_fields = {</blockquote><blockquote>“Doctype Name”: [</blockquote><blockquote>{</blockquote><blockquote>“fieldname”: “another_fieldname”,</blockquote><blockquote>“label”: “Another Label”,</blockquote><blockquote>“fieldtype”: “Select”,</blockquote><blockquote>“options”: “Option 1\nOption 2\nOption 3”,</blockquote><blockquote>“insert_after”: “your_fieldname”,</blockquote><blockquote>“in_list_view”: 1,</blockquote><blockquote>“description”: “Description for another field”,</blockquote><blockquote>“depends_on”: “eval:doc.another_condition == 1”,</blockquote><blockquote>“fetch_from”: “”,</blockquote><blockquote>“read_only”: 1,</blockquote><blockquote>“default”: “Option 1”,</blockquote><blockquote>“translated_doctype”: “Translated DocType Name”</blockquote><blockquote>}</blockquote><blockquote>]</blockquote><blockquote>}</blockquote><h3>Explanation of Field Attributes:</h3><ul><li><strong>fieldname</strong>: The unique identifier for the field.</li><li><strong>label</strong>: The label that will be displayed to the user.</li><li><strong>fieldtype</strong>: The type of field (e.g., Data, Select, Link, etc.).</li><li><strong>options</strong>: Additional options for the field (used mainly for fields like Link, Select, etc.).</li><li><strong>insert_after</strong>: The field after which this new field will be inserted.</li><li><strong>in_list_view</strong>: Set to 1 if you want this field to be visible in the list view.</li><li><strong>description</strong>: A description of the field.</li><li><strong>depends_on</strong>: Conditions to determine when this field should be displayed or enabled.</li><li><strong>fetch_from</strong>: Specifies which value to fetch from another linked field.</li><li><strong>read_only</strong>: Set to 1 if the field should be read-only.</li><li><strong>default</strong>: The default value for the field.</li><li><strong>translated_doctype</strong>: The name of the DocType when translated into another language.</li></ul><p>This approach ensures that you define all the necessary attributes for each field in a structured way within the <strong>custom_fields.py</strong> file for the specified DocType.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/0*XZcgTQsHJchyVXsn" /></figure><ul><li>After adding the fields in the<strong> custom_fields.py</strong>, you’ll need to follow these steps to ensure the fields are properly applied to your Frappe ERPNext instance:</li></ul><h3>Step 1: Add Sequence in patches.txt</h3><p>In your module’s <strong>patches.txt</strong> file, you need to add a sequence for the custom fields you’ve just created. This will tell the system to apply your custom fields during the next migration.</p><p>Here’s how to do it:</p><ol><li>Open the <strong>patches.txt</strong> file located in your module.</li><li>Add a new line with the following format:</li><li>execute:from campus_erp.campus_erp.setup import create_custom_fields; create_custom_fields() #30–08–2024</li><li>If the date <strong>(YYYY-MM-DD)</strong> is already present for today’s date, append a sequence number like this:</li><li>execute:from campus_erp.campus_erp.setup import create_custom_fields; create_custom_fields() #1 #30–08–2024</li><li>If you need to add more sequences on the same date, you can increment the number like <strong>#2, #3</strong>, etc.</li></ol><h3>Step 2: Execute the bench migrate Command</h3><ol><li>After updating the <strong>patches.txt</strong> file, open your terminal.</li><li>Navigate to the root directory of your Frappe app.</li><li>Run the following command to apply the patches:</li></ol><ul><li>bench migrate</li></ul><p>This will execute the patch and apply your new custom fields to the specified DocType.</p><h3>Summary:</h3><ul><li>Add your custom fields in <strong>custom_fields.py</strong>.</li><li>Update the <strong>patches.txt</strong> file by adding a new line for the patch.</li><li>If today’s date is already used, append a sequence number to the patch entry.</li><li>Run <strong>bench migrate</strong> to apply your changes.</li></ul><p>This ensures that the custom fields are properly added, even if multiple updates happen on the same day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VND8josdt4oVwJ-C" /></figure><ul><li><strong>Property Setter:-</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PzCs7UMmx3icNFpHHvd8Dw.png" /></figure><ul><li>To handle the addition of properties in<strong> property_setter.py</strong>, updating <strong>patches.txt</strong>, and executing the migration in Frappe ERPNext, follow these steps:</li><li>Set Properties in <strong>property_setter.py</strong>: Define the properties in the <strong>property_setter.py</strong> file as needed for your specific DocType fields.</li><li>Update <strong>patches.txt</strong>: After setting the properties in <strong>property_setter.py</strong>, you need to add an entry in the <strong>patches.txt</strong> file to ensure the properties are applied correctly. Here’s what you should do:</li><li>Open the <strong>patches.txt</strong> file.</li><li>If today’s date is not already listed in the file, add a new entry like this:</li><li>execute:from campus_erp.campus_erp.setup import create_property_setters; create_property_setters() #1 #11–10–2024</li><li>The sequence numbers ensure that multiple patches on the same day are executed in the correct order.</li><li>Execute the <strong>bench migrate</strong> Command:</li><li>Open the terminal in your Frappe/ERPNext installation directory.</li><li>Run the following command to apply the property changes:</li><li>Bench migrate</li><li>This command will apply the changes made in the<strong> property_setter.py</strong> file and update the database schema with the new property settings.</li></ul><h3>Summary</h3><ul><li><strong>Step 1</strong>: Set properties in <strong>property_setter.py</strong>.</li><li><strong>Step 2</strong>: Update the <strong>patches.txt</strong> file with the appropriate sequence and date for the property setters.</li><li><strong>Step 3</strong>: Run <strong>bench migrate</strong> to apply the changes.</li></ul><p>This process ensures that all the properties are correctly set for your DocType fields, and the changes are managed and tracked using the patch sequence in <strong>patches.txt</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VND8josdt4oVwJ-C" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ffe5a5f214e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>