<?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 Avish Joshi on Medium]]></title>
        <description><![CDATA[Stories by Avish Joshi on Medium]]></description>
        <link>https://medium.com/@avishjoshi2012?source=rss-3d3e5075fdac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CBR40c1Bb7oIEw2MLE9afA.jpeg</url>
            <title>Stories by Avish Joshi on Medium</title>
            <link>https://medium.com/@avishjoshi2012?source=rss-3d3e5075fdac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 19:17:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@avishjoshi2012/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[Easy Ways to Use Databases with Python]]></title>
            <link>https://medium.com/@avishjoshi2012/easy-ways-to-use-databases-with-python-224a07dd84c6?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/224a07dd84c6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Wed, 25 Dec 2024 13:43:28 GMT</pubDate>
            <atom:updated>2024-12-25T13:43:28.578Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Database?</h3><p>A database is like a big notebook where you can store and organize information, so you don’t forget it. It helps you find what you need quickly! For example, you can use it to save names, ages, or even your favorite snacks.</p><p>---</p><p>Why Use Python with Databases?</p><p>Python is like a helpful robot that can talk to databases. With Python, you can:</p><p>Save new information.</p><p>Find information you saved earlier.</p><p>Change or delete things you don’t need anymore.</p><p>---</p><p>Let&#39;s Use a Simple Database: SQLite</p><p>SQLite is a tiny database that works inside your computer, like a magic box for your data.</p><p>Step-by-Step Guide:</p><p>1. Open the Database<br>We’ll use Python to open or make a new database.</p><p>2. Save Information<br>You can write things like names and ages.</p><p>3. Look at the Information Later<br>Python can help you find the things you saved.</p><p>---</p><p>Here’s the easy Python code:</p><p>import sqlite3 # This helps us use the database</p><p># Open or create a database<br>connection = sqlite3.connect(&#39;my_database.db&#39;)</p><p># Make a place to write in the database<br>cursor = connection.cursor()</p><p># Create a table to store names and ages<br>cursor.execute(&#39;&#39;&#39;<br>CREATE TABLE IF NOT EXISTS friends (<br> name TEXT,<br> age INTEGER<br>)<br>&#39;&#39;&#39;)</p><p># Add some friends to the table<br>cursor.execute(&quot;INSERT INTO friends (name, age) VALUES (&#39;Alice&#39;, 10)&quot;)<br>cursor.execute(&quot;INSERT INTO friends (name, age) VALUES (&#39;Bob&#39;, 12)&quot;)</p><p># Save the changes<br>connection.commit()</p><p># Look at the table<br>cursor.execute(&quot;SELECT * FROM friends&quot;)<br>print(cursor.fetchall())</p><p># Close the database when you&#39;re done<br>connection.close()</p><p>---</p><p>What Does the Code Do?</p><p>1. Open the Magic Box: The database file is created (my_database.db).</p><p>2. Make a Table: Like drawing columns for &quot;Name&quot; and &quot;Age&quot; in your notebook.</p><p>3. Add Friends: Save names and ages to the table.</p><p>4. Check the List: Print all the names and ages saved.</p><p>5. Close the Box: Always close the database when you’re finished.</p><p>---</p><p>What Can You Do Next?</p><p>Add more friends with their ages.</p><p>Try changing a friend&#39;s age.</p><p>Look for a specific name in the list.</p><p>Now you know how to store and find information using Python and databases. It’s like having a super-organized notebook, but much cooler!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=224a07dd84c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a software from python]]></title>
            <link>https://medium.com/@avishjoshi2012/how-to-create-a-software-from-python-7196ec622991?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/7196ec622991</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 11:12:02 GMT</pubDate>
            <atom:updated>2024-12-23T11:12:02.538Z</atom:updated>
            <content:encoded><![CDATA[<p>How to Create Software Using Python</p><p>Python is a versatile programming language widely used for creating software applications. Its simplicity and vast library support make it an ideal choice for beginners and professionals alike. Here’s a step-by-step guide to help you build software using Python.</p><p>---</p><p>Step 1: Define the Purpose of Your Software</p><p>Before you start coding, determine the purpose of your software. Ask yourself:</p><p>What problem will it solve?</p><p>Who is the target audience?</p><p>What features will it have?</p><p>For example, you could create a to-do list app, a calculator, or a game.</p><p>---</p><p>Step 2: Set Up Your Development Environment</p><p>1. Install Python<br>Download and install Python from the official website. Make sure to add Python to your system&#39;s PATH during installation.</p><p>2. Install an Integrated Development Environment (IDE)<br>Choose an IDE or code editor like:</p><p>PyCharm</p><p>Visual Studio Code</p><p>Jupyter Notebook</p><p>3. Install Necessary Libraries<br>Use pip, Python’s package manager, to install additional libraries. For example:</p><p>pip install flask # For web apps<br>pip install pygame # For games</p><p>---</p><p>Step 3: Plan Your Software</p><p>Create a blueprint of your software. Outline its:</p><p>Features and functions</p><p>User interface (UI) design</p><p>Data storage needs (e.g., database or file)</p><p>---</p><p>Step 4: Write the Code</p><p>Start by creating a basic version of your software, then gradually add features.</p><p>Example: A Simple To-Do List App</p><p># to_do_list.py</p><p>tasks = []</p><p>def show_menu():<br> print(&quot;\nTo-Do List&quot;)<br> print(&quot;1. Add Task&quot;)<br> print(&quot;2. View Tasks&quot;)<br> print(&quot;3. Remove Task&quot;)<br> print(&quot;4. Exit&quot;)</p><p>def add_task():<br> task = input(&quot;Enter a new task: &quot;)<br> tasks.append(task)<br> print(f&quot;Task &#39;{task}&#39; added.&quot;)</p><p>def view_tasks():<br> if not tasks:<br> print(&quot;No tasks found.&quot;)<br> else:<br> print(&quot;Your tasks:&quot;)<br> for i, task in enumerate(tasks, 1):<br> print(f&quot;{i}. {task}&quot;)</p><p>def remove_task():<br> view_tasks()<br> try:<br> task_num = int(input(&quot;Enter the task number to remove: &quot;))<br> removed_task = tasks.pop(task_num - 1)<br> print(f&quot;Task &#39;{removed_task}&#39; removed.&quot;)<br> except (IndexError, ValueError):<br> print(&quot;Invalid task number.&quot;)</p><p>while True:<br> show_menu()<br> choice = input(&quot;Choose an option: &quot;)<br> if choice == &#39;1&#39;:<br> add_task()<br> elif choice == &#39;2&#39;:<br> view_tasks()<br> elif choice == &#39;3&#39;:<br> remove_task()<br> elif choice == &#39;4&#39;:<br> print(&quot;Goodbye!&quot;)<br> break<br> else:<br> print(&quot;Invalid choice. Please try again.&quot;)</p><p>---</p><p>Step 5: Test Your Software</p><p>Test your software to ensure all features work correctly.</p><p>Debug errors using your IDE’s debugging tools or by adding print statements.</p><p>---</p><p>Step 6: Add Advanced Features</p><p>Once the basic version works, add advanced features such as:</p><p>GUI (Graphical User Interface)<br>Use libraries like Tkinter or PyQt to create a GUI.</p><p>Database Integration<br>Use SQLite or MySQL to store data persistently.</p><p>---</p><p>Step 7: Package Your Software</p><p>To make your software executable:</p><p>1. Install PyInstaller:</p><p>pip install pyinstaller</p><p>2. Create an executable:</p><p>pyinstaller --onefile to_do_list.py</p><p>This will create a standalone .exe file (on Windows) that others can run without installing Python.</p><p>---</p><p>Step 8: Share Your Software</p><p>Upload your project to platforms like GitHub.</p><p>Distribute your software via file-sharing platforms or your website.</p><p>---</p><p>Final Tips</p><p>Keep your code clean and well-documented.</p><p>Start small and gradually build more complex projects.</p><p>Learn from online tutorials, forums, and Python documentation.</p><p>By following these steps, you can create software using Python and share it with the world. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7196ec622991" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CRUD in python]]></title>
            <link>https://medium.com/@avishjoshi2012/crud-in-python-2c4f18bb5e06?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c4f18bb5e06</guid>
            <category><![CDATA[read]]></category>
            <category><![CDATA[updates]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[delete]]></category>
            <category><![CDATA[create]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 14:04:20 GMT</pubDate>
            <atom:updated>2024-12-16T14:04:20.067Z</atom:updated>
            <content:encoded><![CDATA[<h3>CRUD Operations in Python: A Beginner’s Guide</h3><p>CRUD stands for <strong>Create, Read, Update, and Delete</strong> — the basic operations for managing data in any application. Whether you’re working with files, databases, or APIs, CRUD is essential. In Python, you can implement CRUD in different ways, such as working with lists, dictionaries, or databases like <strong>SQLite</strong>.</p><h3>1. CRUD with Python Lists</h3><p>Lists are the simplest data structure to practice CRUD operations.</p><h3>Create</h3><p>To add an item to a list:</p><pre>data = []  # Empty list<br>data.append(&quot;Apple&quot;)  # Adding a new item<br>print(data)  # Output: [&#39;Apple&#39;]</pre><h3>Read</h3><p>To view items in a list:</p><pre>for item in data:<br>    print(item)  # Output: Apple</pre><h3>Update</h3><p>To modify an item:</p><pre>data[0] = &quot;Orange&quot;  # Updating the first item<br>print(data)  # Output: [&#39;Orange&#39;]</pre><h3>Delete</h3><p>To remove an item:</p><pre>data.remove(&quot;Orange&quot;)  # Delete by value<br>print(data)  # Output: []</pre><h3>2. CRUD with Python Dictionaries</h3><p>Dictionaries allow key-value pairs, ideal for structured data.</p><h3>Create</h3><p>To add key-value pairs:</p><pre>data = {}<br>data[&quot;name&quot;] = &quot;John&quot;  # Adding a new entry<br>print(data)  # Output: {&#39;name&#39;: &#39;John&#39;}</pre><h3>Read</h3><p>To access values:</p><pre>print(data[&quot;name&quot;])  # Output: John</pre><h3>Update</h3><p>To change a value:</p><pre>data[&quot;name&quot;] = &quot;Jane&quot;  # Updating value<br>print(data)  # Output: {&#39;name&#39;: &#39;Jane&#39;}</pre><h3>Delete</h3><p>To remove a key-value pair:</p><pre>del data[&quot;name&quot;]<br>print(data)  # Output: {}</pre><h3>3. CRUD with SQLite Database in Python</h3><p>SQLite is a lightweight database built into Python, perfect for managing persistent data.</p><h3>Setup SQLite</h3><p>First, import the sqlite3 module and connect to a database:</p><pre>import sqlite3</pre><pre>conn = sqlite3.connect(&quot;example.db&quot;)  # Create or connect to a database<br>cursor = conn.cursor()  # To execute SQL queries</pre><h3>Create Table</h3><p>To create a table for storing data:</p><pre>cursor.execute(&quot;&quot;&quot;<br>CREATE TABLE IF NOT EXISTS users (<br>    id INTEGER PRIMARY KEY,<br>    name TEXT,<br>    age INTEGER<br>)<br>&quot;&quot;&quot;)<br>conn.commit()</pre><h3>Create (Insert Data)</h3><p>To add a new record to the table:</p><pre>cursor.execute(&quot;INSERT INTO users (name, age) VALUES (?, ?)&quot;, (&quot;Alice&quot;, 25))<br>conn.commit()</pre><h3>Read (Fetch Data)</h3><p>To retrieve data from the table:</p><pre>cursor.execute(&quot;SELECT * FROM users&quot;)<br>rows = cursor.fetchall()</pre><pre>for row in rows:<br>    print(row)  # Output: (1, &#39;Alice&#39;, 25)</pre><h3>Update</h3><p>To modify a record:</p><pre>cursor.execute(&quot;UPDATE users SET age = ? WHERE name = ?&quot;, (26, &quot;Alice&quot;))<br>conn.commit()</pre><h3>Delete</h3><p>To remove a record:</p><pre>cursor.execute(&quot;DELETE FROM users WHERE name = ?&quot;, (&quot;Alice&quot;,))<br>conn.commit()</pre><h3>Close the Connection</h3><p>Always close the database connection when done:</p><pre>conn.close()</pre><h3>Summary</h3><p>CRUD operations are fundamental for working with data. Here’s a quick recap:</p><ul><li><strong>Lists</strong>: Great for basic practice of adding, reading, updating, and deleting elements.</li><li><strong>Dictionaries</strong>: Perfect for structured key-value data.</li><li><strong>SQLite</strong>: Use it for managing persistent data in a real-world application.</li></ul><p>By understanding CRUD, you can build data-driven Python applications with ease! 🎉</p><p>Let me know if you’d like code examples for another database or more advanced CRUD features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c4f18bb5e06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GUI in python]]></title>
            <link>https://medium.com/@avishjoshi2012/gui-in-python-5ea12f18d4b9?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ea12f18d4b9</guid>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 13:52:27 GMT</pubDate>
            <atom:updated>2024-12-11T13:52:27.424Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Build a GUI with Tkinter in Python</h3><p>Graphical User Interfaces (GUIs) make applications user-friendly and visually appealing. Python’s Tkinter library is one of the simplest ways to create GUIs, making it a great choice for beginners and experienced developers alike. In this blog, we’ll walk through the basics of using Tkinter to create a functional GUI application.</p><h4>What is Tkinter?</h4><p>Tkinter is Python’s standard GUI library. It provides a fast and straightforward way to design and develop GUI applications. It comes pre-installed with Python, so there’s no need for additional installations.</p><h4>Step 1: Setting Up Tkinter</h4><p>To get started, you need to import Tkinter and create a main window.</p><pre>import tkinter as tk</pre><pre># Create the main application window<br>root = tk.Tk()</pre><pre># Set the title of the window<br>root.title(&quot;My First GUI&quot;)</pre><pre># Set the window size<br>root.geometry(&quot;400x300&quot;)</pre><pre># Run the application<br>root.mainloop()</pre><p>This script creates a basic window with a title and specified dimensions.</p><h4>Step 2: Adding Widgets</h4><p>Widgets are the building blocks of a Tkinter application. Common widgets include buttons, labels, entry boxes, and more.</p><p>Here’s how you can add some basic widgets:</p><pre># Adding a label<br>label = tk.Label(root, text=&quot;Welcome to My GUI!&quot;, font=(&quot;Arial&quot;, 16))<br>label.pack(pady=10)</pre><pre># Adding an entry field<br>entry = tk.Entry(root, width=30)<br>entry.pack(pady=5)</pre><pre># Adding a button<br>def greet():<br>    user_name = entry.get()<br>    greeting_label.config(text=f&quot;Hello, {user_name}!&quot;)</pre><pre>button = tk.Button(root, text=&quot;Submit&quot;, command=greet)<br>button.pack(pady=5)</pre><pre># Adding a dynamic label<br>greeting_label = tk.Label(root, text=&quot;&quot;, font=(&quot;Arial&quot;, 14))<br>greeting_label.pack(pady=10)</pre><h4>Step 3: Organizing the Layout</h4><p>Tkinter offers three layout managers to position widgets: <strong>pack</strong>, <strong>grid</strong>, and <strong>place</strong>.</p><ul><li><strong>Pack</strong>: Stacks widgets vertically or horizontally.</li><li><strong>Grid</strong>: Arranges widgets in a grid format.</li><li><strong>Place</strong>: Places widgets at specific coordinates.</li></ul><p>Here’s an example using the grid layout:</p><pre># Using grid layout<br>label.grid(row=0, column=0, columnspan=2, pady=10)<br>entry.grid(row=1, column=0, columnspan=2, pady=5)<br>button.grid(row=2, column=0, pady=5)<br>greeting_label.grid(row=3, column=0, columnspan=2, pady=10)</pre><h4>Step 4: Adding Style</h4><p>Tkinter supports styling through its ttk module. You can use themed widgets and styles for a modern look.</p><pre>from tkinter import ttk</pre><pre># Create a styled button<br>styled_button = ttk.Button(root, text=&quot;Styled Button&quot;)<br>styled_button.pack(pady=10)</pre><h4>Step 5: Finalizing and Running the App</h4><p>Combine all the elements into a complete application:</p><pre>import tkinter as tk<br>from tkinter import ttk</pre><pre>def greet():<br>    user_name = entry.get()<br>    greeting_label.config(text=f&quot;Hello, {user_name}!&quot;)</pre><pre># Main window<br>root = tk.Tk()<br>root.title(&quot;My First GUI&quot;)<br>root.geometry(&quot;400x300&quot;)</pre><pre># Widgets<br>label = tk.Label(root, text=&quot;Welcome to My GUI!&quot;, font=(&quot;Arial&quot;, 16))<br>label.pack(pady=10)</pre><pre>entry = tk.Entry(root, width=30)<br>entry.pack(pady=5)</pre><pre>button = tk.Button(root, text=&quot;Submit&quot;, command=greet)<br>button.pack(pady=5)</pre><pre>greeting_label = tk.Label(root, text=&quot;&quot;, font=(&quot;Arial&quot;, 14))<br>greeting_label.pack(pady=10)</pre><pre># Run the application<br>root.mainloop()</pre><h4>Conclusion</h4><p>Building a GUI with Tkinter is straightforward and fun. With practice, you can create complex applications by combining widgets, layouts, and logic. Start experimenting with Tkinter and build something amazing today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ea12f18d4b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tuples In python]]></title>
            <link>https://medium.com/@avishjoshi2012/tuples-in-python-26644171a637?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/26644171a637</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tuples-in-python]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Thu, 28 Nov 2024 14:02:28 GMT</pubDate>
            <atom:updated>2024-11-28T14:02:28.734Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xJ9_n5gw_BTHblRQ_LfoQ.jpeg" /></figure><h3>Understanding Tuples in Python</h3><p>In Python, a <strong>tuple</strong> is like a container where you can store multiple items. Imagine a tuple as a box where you can keep different things (numbers, words, or both) together. Once you put something in this box, you can’t change it. That’s what makes tuples <strong>immutable</strong> (unchangeable).</p><h3>What is a Tuple?</h3><ul><li>A tuple is a collection of items, just like a list, but you <strong>cannot change</strong> items inside a tuple.</li><li>Tuples are written using <strong>parentheses </strong><strong>()</strong>.</li></ul><h3>How to Create a Tuple?</h3><p>Here’s an example of a tuple:</p><pre>fruits = (&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;)</pre><p>This tuple has three items: &quot;apple&quot;, &quot;banana&quot;, and &quot;cherry&quot;.</p><h3>Features of Tuples</h3><ol><li><strong>Immutable</strong>: Once created, you can’t add, remove, or change items in a tuple.</li><li><strong>Ordered</strong>: Items in a tuple have a fixed order.</li><li><strong>Can Hold Different Data Types</strong>: A tuple can store numbers, words, or even a mix of both.</li></ol><p>Example:</p><pre>my_tuple = (1, &quot;hello&quot;, 3.5)</pre><h3>Why Use a Tuple?</h3><ol><li>Use a tuple when you want to make sure your data can’t be changed.</li><li>They’re faster than lists.</li></ol><h3>How to Access Items in a Tuple?</h3><p>You can get items from a tuple using their position, called an <strong>index</strong>.</p><p>Example:</p><pre>fruits = (&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;)<br>print(fruits[1])  # Outputs: banana</pre><h3>When to Use Tuples?</h3><ul><li>When storing data that shouldn’t be changed, like days of the week, months, or coordinates.</li></ul><p>Example:</p><pre>days = (&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;)</pre><h3>Key Points</h3><ul><li>Tuples are great for protecting data.</li><li>Use them when you need a list of items that won’t change.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26644171a637" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning the while Loop in Python: Easy Guide for Beginners]]></title>
            <link>https://medium.com/@avishjoshi2012/learning-the-while-loop-in-python-easy-guide-for-beginners-ebf267e027e0?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebf267e027e0</guid>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[while-loop]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 14:05:00 GMT</pubDate>
            <atom:updated>2024-11-22T14:05:00.365Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re just starting with Python, the while loop might seem a little tricky at first. But don’t worry! This guide will help you understand how it works in simple terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2AriaMe-ettkNYSFfZE5w.jpeg" /></figure><h3>What is a while Loop?</h3><p>A while loop is like a repeating question: <strong>&quot;Is this condition true?&quot;</strong> If the answer is &quot;yes&quot; (or True in Python), it keeps running the same block of code again and again. When the answer is &quot;no&quot; (or False), the loop stops.</p><h3>How It Works</h3><p>Imagine you’re playing a game, and you keep asking yourself, <strong>“Do I still have lives left?”</strong> If you do, you keep playing. Once you’re out of lives, you stop. This is just like a while loop in Python!</p><h3>How to Write a while Loop</h3><p>Here’s how a while loop looks in Python:</p><pre>while condition:<br>    # Code that repeats as long as the condition is True</pre><ul><li><strong>condition</strong>: A question or rule (like &quot;Do I have lives left?&quot;) that Python checks every time.</li><li><strong>Code inside</strong>: The things you want Python to do while the condition is True.</li></ul><h3>Example 1: Counting Numbers</h3><p>Let’s make a program that counts from 1 to 5.</p><pre>number = 1  # Start with 1<br>while number &lt;= 5:  # Keep going while the number is 5 or less<br>    print(number)  # Show the number<br>    number += 1  # Add 1 to the number</pre><p><strong>What happens?</strong></p><ol><li>Python starts with number = 1.</li><li>It checks, <strong>“Is 1 less than or equal to 5?”</strong> (Yes!)</li><li>It prints 1 and adds 1 to number.</li><li>Now number is 2, and Python checks again: <strong>&quot;Is 2 less than or equal to 5?&quot;</strong> (Yes!)</li><li>It keeps going until number becomes 6. Then the loop stops.</li></ol><h3>Example 2: Ask Until You Get the Right Answer</h3><p>Let’s write a program that keeps asking for a password until the correct one is entered.</p><pre>password = &quot;&quot;  # Start with no password<br>while password != &quot;pythonrocks&quot;:  # Keep going if the password is wrong<br>    password = input(&quot;Enter the password: &quot;)  # Ask for the password</pre><pre>print(&quot;Access granted!&quot;)</pre><p><strong>What happens here?</strong></p><ul><li>Python keeps asking, <strong>“Did you type the correct password?”</strong></li><li>If the answer is no, it asks again.</li><li>When you type &quot;pythonrocks&quot;, the loop ends, and it prints <strong>&quot;Access granted!&quot;</strong></li></ul><blockquote>If your code never stops keep in mind to press <strong>CTRL + C</strong> to stop the program.</blockquote><p>Once you get the hang of it, while loops will feel like magic that repeats your code until the right moment! 🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebf267e027e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[If and Elif in python.]]></title>
            <link>https://medium.com/@avishjoshi2012/if-and-elif-in-python-20e915be48f9?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/20e915be48f9</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[if]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 11:49:19 GMT</pubDate>
            <atom:updated>2024-11-21T11:49:19.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QY-ZwXeJDf0oxGI8ImjX5Q.jpeg" /></figure><h3>Understanding if and elif in Python</h3><p>Conditional statements are essential in programming as they help us make decisions based on specific conditions. In Python, the if and elif keywords allow you to run certain blocks of code depending on whether a condition is true or not.</p><h3>The Basics: if</h3><p>The if statement checks a condition. If the condition evaluates to True, Python executes the code inside the block.</p><p><strong>Syntax:</strong></p><pre>if condition:<br>    # code to run if the condition is True</pre><p><strong>Example:</strong></p><pre>temperature = 30<br>if temperature &gt; 25:<br>    print(&quot;It&#39;s a hot day!&quot;)</pre><p>Output:</p><pre>It&#39;s a hot day!</pre><h3>Adding More Options with elif</h3><p>The elif (short for &quot;else if&quot;) allows you to check multiple conditions sequentially. Python evaluates conditions from top to bottom, and as soon as one is true, it stops checking the rest.</p><p><strong>Syntax:</strong></p><pre>if condition1:<br>    # code to run if condition1 is True<br>elif condition2:<br>    # code to run if condition2 is True</pre><p><strong>Example:</strong></p><pre>temperature = 20<br>if temperature &gt; 25:<br>    print(&quot;It&#39;s a hot day!&quot;)<br>elif temperature &gt; 15:<br>    print(&quot;It&#39;s a pleasant day!&quot;)</pre><p>Output:</p><pre>It&#39;s a pleasant day!</pre><h3>Combining if, elif, and else</h3><p>The else block can be used as a catch-all if none of the if or elif conditions are true.</p><p><strong>Example:</strong></p><pre>temperature = 10<br>if temperature &gt; 25:<br>    print(&quot;It&#39;s a hot day!&quot;)<br>elif temperature &gt; 15:<br>    print(&quot;It&#39;s a pleasant day!&quot;)<br>else:<br>    print(&quot;It&#39;s a cold day!&quot;)</pre><p>Output:</p><pre>It&#39;s a cold day!</pre><h3>Key Points to Remember</h3><ol><li>Use if for the first condition.</li><li>Use elif for additional conditions.</li><li>You can include multiple elif blocks.</li><li>The else block is optional and executes if none of the previous conditions are true.</li></ol><blockquote><strong><em>(all the codes are in python and not other programming languages)</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20e915be48f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QR codes in python]]></title>
            <link>https://medium.com/@avishjoshi2012/qr-codes-in-python-4f524503c4cc?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f524503c4cc</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[qr-code]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Wed, 20 Nov 2024 12:39:52 GMT</pubDate>
            <atom:updated>2024-11-20T12:39:52.955Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QOBMeHEp81S2ysv1q6vCw.png" /></figure><p>How to Create a QR Code in Python</p><p>QR codes are useful for sharing information quickly, and Python makes it easy to generate them. Here’s a simple step-by-step guide using the `qrcode` module.</p><p>— -</p><p>Step 1: Install the QR Code Module<br>To get started, install the required Python library:</p><p>1. Visit the official `qrcode` module page at [<a href="http://pypi.org/project/qrcode">pypi.org/project/qrcode</a>](<a href="https://pypi.org/project/qrcode/">https://pypi.org/project/qrcode/</a>).<br>2. Open your terminal and type the following commands:</p><pre>bash<br> pip install qrcode<br> pip install “qrcode[pil]”<br></pre><p>— -</p><p>Step 2: Generate a Basic QR Code<br>Once the installation is complete, use the code below to create a QR code:</p><pre>python<br>import qrcode# Create a QR code with your name or any data<br>img = qrcode.make(‘Your Name Here’)# Check the type of the generated image<br>print(type(img)) # Output: &lt;class ‘qrcode.image.pil.PilImage’&gt;# Save the QR code to a file<br>img.save(“my_name_qr.png”)<br></pre><p>— -</p><p>Step 3: Customize the QR Code<br>Replace <strong>`’Your Name Here’`</strong> with your own name or any text you want. Change the file name to save the QR code as a PNG, JPEG, or GIF. For example:</p><pre>python<br>img = qrcode.make(‘John Doe’)<br>img.save(“john_doe_qr.jpeg”)<br></pre><p>— -</p><p>#### Output<br>After running the code, you’ll find a file (e.g., `my_name_qr.png`) in your folder. Scan the QR code using any QR code scanner to display the text you provided, such as your name.</p><p>— -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wodqJ3f-yF6YiTJfzW2Lw.png" /></figure><p><strong>My facebook</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f524503c4cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Randomization in Python]]></title>
            <link>https://medium.com/@avishjoshi2012/randomization-in-python-f48931fe54b3?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/f48931fe54b3</guid>
            <category><![CDATA[randomization]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 12:40:30 GMT</pubDate>
            <atom:updated>2024-11-19T12:40:30.710Z</atom:updated>
            <content:encoded><![CDATA[<p>Randomization in Python: A Beginner’s Guide</p><p>Randomization is a fascinating concept in programming that allows us to create unpredictability. Whether you’re designing a game, building a simulation, or simply experimenting, randomness often plays a critical role. In Python, the `random` module provides tools to generate random numbers, shuffle data, and much more. In this article, we’ll break down the basics of using `random` for beginners.</p><p>— -</p><p>What is Randomization?</p><p>Randomization refers to the process of generating values that are unpredictable and lack a specific pattern. For example, rolling a dice gives a random result between 1 and 6. Similarly, picking a card from a shuffled deck is another example of randomness.</p><p>— -</p><p>The `random` Module in Python</p><p>Python makes randomization easy with the built-in `random` module. Before we use it, we need to import it by adding the following line at the beginning of your script:</p><pre><br>import random</pre><p>This gives you access to a variety of randomization functions.</p><p>— -</p><p>Generating Random Numbers</p><p>Example: Random Float Between 0 and 1</p><p>The `random()` function generates a random floating-point number between `0` and `1` (not including `1`).</p><pre><br>import random</pre><pre>print(random.random()) # Example output: 0.678935491293<br></pre><p>Example: Random Integer</p><p>Use `randint(a, b)` to generate a random integer between `a` and `b` (inclusive).</p><pre><br>print(random.randint(1, 10)) # Example output: 7<br></pre><p>— -</p><p>Choosing Random Values</p><p>Example: Picking a Random Item</p><p>The `choice()` function selects a random item from a list, tuple, or any sequence.</p><pre><br>fruits = [‘apple’, ‘banana’, ‘cherry’, ‘date’]<br>print(random.choice(fruits)) # Example output: cherry<br></pre><p>Example: Picking Multiple Random Items</p><p>To pick multiple random items, use `sample()`:</p><pre><br>colors = [‘red’, ‘blue’, ‘green’, ‘yellow’]<br>print(random.sample(colors, 2)) # Example output: [‘blue’, ‘green’]<br></pre><p>— -</p><p>Shuffling a List</p><p>The `shuffle()` function randomizes the order of items in a list.</p><pre><br>numbers = [1, 2, 3, 4, 5]<br>random.shuffle(numbers)<br>print(numbers) # Example output: [3, 5, 1, 2, 4]<br></pre><p>— -</p><p>Applications of Randomization</p><p>1. Games: Simulating dice rolls, shuffling cards, or creating random enemies.<br>2. Data Science: Splitting data into random training and testing sets.<br>3. Simulations: Modeling random events like weather or customer behavior.<br>4. Creative Projects: Generating random art, music, or patterns.</p><p>— -</p><p>Tips for Beginners</p><p>1. Experiment: Play with different functions in the `random` module to see how they work.<br>2. Read the Documentation: The official Python documentation for the `random` module is an excellent resource.<br>3. Start Simple: Begin with basic functions like `randint()` and `choice()` before diving into advanced concepts.</p><p>— -</p><p>Conclusion</p><p>Randomization is an exciting and powerful tool in Python that opens the door to endless possibilities. With the `random` module, you can easily add unpredictability to your programs. Whether you’re a beginner or a seasoned programmer, experimenting with randomness can be both fun and educational. Start small, explore, and enjoy the journey into the world of Python randomization!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f48931fe54b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Operators in python]]></title>
            <link>https://medium.com/@avishjoshi2012/about-operators-of-python-09bb2ebc54f0?source=rss-3d3e5075fdac------2</link>
            <guid isPermaLink="false">https://medium.com/p/09bb2ebc54f0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[operators-in-python]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Avish Joshi]]></dc:creator>
            <pubDate>Fri, 15 Nov 2024 13:34:23 GMT</pubDate>
            <atom:updated>2024-11-15T13:34:52.733Z</atom:updated>
            <content:encoded><![CDATA[<p>Operators in python</p><p>1. Arithmetic Operators</p><p>Arithmetic operators are used for mathematical operations on numbers.</p><p>+ : Addition – Adds two operands.</p><p>- : Subtraction – Subtracts the right operand from the left operand.</p><p>* : Multiplication – Multiplies two operands.</p><p>/ : Division – Divides the left operand by the right, returning a float even when both operands are integers.</p><p>// : Floor Division – Divides the left operand by the right and returns the largest integer less than or equal to the result.</p><p>% : Modulus – Returns the remainder when the left operand is divided by the right.</p><p>** : Exponentiation – Raises the left operand to the power of the right operand.</p><p>2. Comparison Operators</p><p>Comparison operators are used to compare two values and produce a boolean result (True or False).</p><p>== : Equal to – Returns True if both operands are equal.</p><p>!= : Not equal to – Returns True if the operands are not equal.</p><p>&gt; : Greater than – Returns True if the left operand is greater than the right.</p><p>&lt; : Less than – Returns True if the left operand is less than the right.</p><p>&gt;= : Greater than or equal to – Returns True if the left operand is greater than or equal to the right.</p><p>&lt;= : Less than or equal to – Returns True if the left operand is less than or equal to the right.</p><p>3. Logical Operators</p><p>Logical operators are used to combine multiple conditions.</p><p>and : Logical AND – Returns True if both conditions are true.</p><p>or : Logical OR – Returns True if at least one condition is true.</p><p>not : Logical NOT – Returns the inverse boolean value of a condition.</p><p>4. Assignment Operators</p><p>Assignment operators are used to assign values to variables, and to modify the value of a variable.</p><p>= : Simple assignment – Assigns the value of the right operand to the left operand.</p><p>+= : Add and assign – Adds the right operand to the left operand and assigns the result to the left operand.</p><p>-= : Subtract and assign – Subtracts the right operand from the left operand and assigns the result to the left operand.</p><p>*= : Multiply and assign – Multiplies the left operand by the right operand and assigns the result to the left operand.</p><p>/= : Divide and assign – Divides the left operand by the right operand and assigns the result to the left operand.</p><p>//= : Floor divide and assign – Performs floor division and assigns the result to the left operand.</p><p>%= : Modulus and assign – Performs modulus operation and assigns the result to the left operand.</p><p>**= : Exponentiate and assign – Raises the left operand to the power of the right operand and assigns the result to the left operand.</p><p>---</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09bb2ebc54f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>