<?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 Aamir Shehzad on Medium]]></title>
        <description><![CDATA[Stories by Aamir Shehzad on Medium]]></description>
        <link>https://medium.com/@aamirshehzad3388?source=rss-890eecdf368c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_8U7aj0LfWGnr1v9</url>
            <title>Stories by Aamir Shehzad on Medium</title>
            <link>https://medium.com/@aamirshehzad3388?source=rss-890eecdf368c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:28:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aamirshehzad3388/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[Day 6: Dictionaries and Sets in Python]]></title>
            <link>https://medium.com/@aamirshehzad3388/day-6-dictionaries-and-sets-in-python-9f10ce71337e?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f10ce71337e</guid>
            <category><![CDATA[python-coding]]></category>
            <category><![CDATA[python-set]]></category>
            <category><![CDATA[python-dictionaries]]></category>
            <category><![CDATA[python-dictionary-method]]></category>
            <category><![CDATA[python-practical]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 05:46:48 GMT</pubDate>
            <atom:updated>2024-12-23T05:46:48.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to Day 6 of the Python 30-Day Journey! Today, we’ll explore two powerful and versatile data structures: dictionaries and sets. Dictionaries allow us to store data in key-value pairs, while sets help us work with unique collections of items. Let’s dive in!</p><h3>1. Dictionaries: Key-Value Pairs</h3><p>A dictionary is a collection of key-value pairs, where each key maps to a specific value. Dictionaries are defined using curly braces {}.</p><h4>a. Creating a Dictionary</h4><pre># Empty dictionary<br>my_dict = {}<br><br># Dictionary with key-value pairs<br>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25, &quot;city&quot;: &quot;New York&quot;}<br>print(person)</pre><p><strong>Output:</strong></p><pre>{&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 25, &#39;city&#39;: &#39;New York&#39;}</pre><h4>b. Accessing Values</h4><p>Use the key to access its associated value.</p><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25, &quot;city&quot;: &quot;New York&quot;}<br>print(person[&quot;name&quot;])  # Outputs: Alice<br>print(person.get(&quot;age&quot;))  # Outputs: 25</pre><h4>c. Adding and Updating Key-Value Pairs</h4><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25}<br>person[&quot;city&quot;] = &quot;New York&quot;  # Add a new key-value pair<br>person[&quot;age&quot;] = 26           # Update an existing key-value pair<br>print(person)</pre><p><strong>Output:</strong></p><pre>{&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 26, &#39;city&#39;: &#39;New York&#39;}</pre><h4>d. Removing Key-Value Pairs</h4><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25, &quot;city&quot;: &quot;New York&quot;}<br>person.pop(&quot;age&quot;)  # Remove key &quot;age&quot;<br>del person[&quot;city&quot;] # Another way to remove a key<br>print(person)</pre><p><strong>Output:</strong></p><pre>{&#39;name&#39;: &#39;Alice&#39;}</pre><h4>e. Iterating Over a Dictionary</h4><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25, &quot;city&quot;: &quot;New York&quot;}<br>for key, value in person.items():<br>    print(f&quot;{key}: {value}&quot;)</pre><p><strong>Output:</strong></p><pre>name: Alice<br>age: 25<br>city: New York</pre><h4>f. Dictionary Methods</h4><p>Here are some useful methods for dictionaries:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jzqVZYH1t3qVOoz0laxltQ.png" /></figure><p><strong>Example:</strong></p><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25}<br>person.update({&quot;city&quot;: &quot;New York&quot;, &quot;age&quot;: 26})<br>print(person)  # Outputs: {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 26, &#39;city&#39;: &#39;New York&#39;}</pre><h3>2. Sets: Working with Unique Items</h3><p>A set is a collection of unordered, unique items. Sets are defined using curly braces {} or the set() function.</p><h4>a. Creating Sets</h4><pre># Empty set<br>empty_set = set()<br><br># Set with unique elements<br>fruits = {&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;}<br>print(fruits)</pre><p><strong>Output:</strong></p><pre>{&#39;banana&#39;, &#39;apple&#39;, &#39;cherry&#39;}</pre><blockquote><strong>Note:</strong> Sets automatically remove duplicates.</blockquote><pre>numbers = {1, 2, 3, 3, 4}<br>print(numbers)  # Outputs: {1, 2, 3, 4}</pre><h4>b. Adding and Removing Items</h4><pre>fruits = {&quot;apple&quot;, &quot;banana&quot;}<br>fruits.add(&quot;cherry&quot;)       # Add an item<br>fruits.remove(&quot;banana&quot;)    # Remove an item<br>print(fruits)</pre><p><strong>Output:</strong></p><pre>{&#39;apple&#39;, &#39;cherry&#39;}</pre><blockquote><strong><em>Note:</em></strong><em> Use </em><em>discard() to remove an item without raising an error if it doesn’t exist.</em></blockquote><h4>c. Set Operations</h4><p>Sets support mathematical operations like union, intersection, and difference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*vwf9l1X3h6UV7yzE4A0Zyw.png" /></figure><p><strong>Example:</strong></p><pre>A = {1, 2, 3}<br>B = {2, 3, 4}<br><br>print(A.union(B))                # Outputs: {1, 2, 3, 4}<br>print(A.intersection(B))         # Outputs: {2, 3}<br>print(A.difference(B))           # Outputs: {1}<br>print(A.symmetric_difference(B)) # Outputs: {1, 4}</pre><h4>d. Checking Membership</h4><pre>fruits = {&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;}<br>print(&quot;apple&quot; in fruits)  # Outputs: True<br>print(&quot;grape&quot; not in fruits)  # Outputs: True</pre><h3>3. Combining Dictionaries and Sets</h3><h4>a. Storing Unique Keys from a Dictionary in a Set</h4><pre>person = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 25, &quot;city&quot;: &quot;New York&quot;}<br>keys_set = set(person.keys())<br>print(keys_set)  # Outputs: {&#39;name&#39;, &#39;age&#39;, &#39;city&#39;}</pre><h4>b. Grouping Unique Items</h4><p>You can use a set to store unique values from a list:</p><pre>values = [1, 2, 2, 3, 4, 4, 5]<br>unique_values = set(values)<br>print(unique_values)  # Outputs: {1, 2, 3, 4, 5}</pre><h3>4. Practical Examples</h3><h4>a. Word Frequency Counter (Using Dictionaries)</h4><p>Count the occurrences of each word in a sentence:</p><pre>sentence = &quot;hello world hello python&quot;<br>word_counts = {}<br><br>for word in sentence.split():<br>    word_counts[word] = word_counts.get(word, 0) + 1<br><br>print(word_counts)</pre><p><strong>Output:</strong></p><pre>{&#39;hello&#39;: 2, &#39;world&#39;: 1, &#39;python&#39;: 1}</pre><h4>b. Finding Common Friends (Using Sets)</h4><pre>friends_A = {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;}<br>friends_B = {&quot;Bob&quot;, &quot;David&quot;, &quot;Charlie&quot;}<br><br>common_friends = friends_A.intersection(friends_B)<br>print(common_friends)  # Outputs: {&#39;Bob&#39;, &#39;Charlie&#39;}</pre><h4>c. Removing Duplicates from a List (Using Sets)</h4><pre>numbers = [1, 2, 2, 3, 4, 4, 5]<br>unique_numbers = list(set(numbers))<br>print(unique_numbers)  # Outputs: [1, 2, 3, 4, 5]</pre><h3>5. Key Takeaways</h3><p><strong>Dictionaries</strong> store data as key-value pairs, making them perfect for fast lookups and mappings.</p><p><strong>Sets</strong> store unique, unordered items and are great for mathematical operations and ensuring data uniqueness.</p><p>Use dictionary methods like keys(), values(), and items() to manage key-value pairs efficiently.</p><p>Use set operations like union(), intersection(), and difference() to work with unique collections.</p><h3>What’s Next?</h3><p>Great work today learning about dictionaries and sets! Tomorrow, on <strong>Day 7</strong>, we’ll dive into <strong>File Handling</strong>, where you’ll learn how to read from and write to files in Python. See you then! 🚀</p><p>In case if you missed the 5th part, here is the link</p><p>https://medium.com/@aamirshehzad3388/day-5-python-data-structures-lists-and-tuples-81559a4f239b</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f10ce71337e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 5: Python Data Structures — Lists and Tuples]]></title>
            <link>https://medium.com/@aamirshehzad3388/day-5-python-data-structures-lists-and-tuples-81559a4f239b?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/81559a4f239b</guid>
            <category><![CDATA[python-data-structures]]></category>
            <category><![CDATA[python-list]]></category>
            <category><![CDATA[tuples-in-python]]></category>
            <category><![CDATA[python-tuple]]></category>
            <category><![CDATA[python-example]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Sun, 15 Dec 2024 06:56:08 GMT</pubDate>
            <atom:updated>2024-12-15T06:56:08.513Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 5: Python Data Structures — Lists and Tuples</h3><p>Welcome to Day 5 of the Python 30-Day Journey! Today, we’ll explore two essential data structures in Python: <strong>lists</strong> and <strong>tuples</strong>. These structures allow you to store, access, and manipulate collections of data efficiently. Let’s dive in!</p><h3>1. Lists: Creating and Manipulating</h3><p>A list is a mutable (modifiable) collection of items, often used to store multiple values of the same or different data types. Lists are defined using square brackets [ ].</p><h4><strong>a. Creating Lists</strong></h4><p>You can create a list with values or an empty list.</p><pre># Creating lists<br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>numbers = [1, 2, 3, 4, 5]<br>mixed = [1, &quot;hello&quot;, 3.14]  # Different data types<br>empty_list = []<br><br>print(fruits)  # Outputs: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]</pre><h4>b. Accessing List Elements</h4><p>Lists are indexed, and you can access elements using their index (starting from 0).</p><p><strong>Example:</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>print(fruits[0])  # Outputs: apple<br>print(fruits[-1])  # Outputs: cherry (last item)</pre><h4>c. Modifying Lists</h4><p>Lists are mutable, meaning you can change their contents.</p><p><strong>Example:</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>fruits[1] = &quot;blueberry&quot;  # Change the second item<br>print(fruits)  # Outputs: [&#39;apple&#39;, &#39;blueberry&#39;, &#39;cherry&#39;]</pre><h4>d. Common List Methods</h4><p>Here are some useful methods for working with lists:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*uXSErk5XN5utregZ5HMOEQ.png" /></figure><p><strong>Examples:</strong></p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>fruits.append(&quot;orange&quot;)<br>print(fruits)  # Outputs: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;, &#39;orange&#39;]<br><br>fruits.remove(&quot;banana&quot;)<br>print(fruits)  # Outputs: [&#39;apple&#39;, &#39;cherry&#39;, &#39;orange&#39;]</pre><h4><strong>e. Iterating Over a List</strong></h4><p>You can use a for loop to iterate through list items.</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>for fruit in fruits:<br>    print(fruit)</pre><h3>2. Tuples: Immutable Collections</h3><p>A tuple is similar to a list but is <strong>immutable</strong>, meaning its contents cannot be changed after creation. Tuples are defined using parentheses ( ).</p><h4>a. Creating Tuples</h4><p>You can create a tuple with or without parentheses.</p><pre># Creating tuples<br>coordinates = (10, 20, 30)<br>colors = &quot;red&quot;, &quot;green&quot;, &quot;blue&quot;  # Parentheses are optional<br>single_item = (42,)  # Comma is required for single-item tuple<br><br>print(coordinates)  # Outputs: (10, 20, 30)</pre><h4>b. Accessing Tuple Elements</h4><p>Access elements just like a list, using indexing.</p><p><strong>Example:</strong></p><pre>colors = (&quot;red&quot;, &quot;green&quot;, &quot;blue&quot;)<br>print(colors[1])  # Outputs: green</pre><h4>c. Immutability</h4><p>Tuples cannot be modified. Attempting to do so raises an error.</p><p><strong>Example:</strong></p><pre>coordinates = (10, 20, 30)<br># coordinates[0] = 15  # This will raise a TypeError</pre><h4>d. Advantages of Tuples</h4><ul><li><strong>Performance:</strong> Tuples are faster than lists.</li><li><strong>Safety:</strong> Since they are immutable, they can be used as keys in dictionaries or to store data you don’t want to accidentally modify.</li></ul><h3>3. Common Tuple Operations</h3><p>Although tuples are immutable, you can still perform certain operations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*uoVdaX2xD7FUX26jhm593g.png" /></figure><h4>Example:</h4><pre>colors = (&quot;red&quot;, &quot;green&quot;, &quot;blue&quot;)<br>print(len(colors))         # Outputs: 3<br>print(colors + (&quot;yellow&quot;,)) # Outputs: (&#39;red&#39;, &#39;green&#39;, &#39;blue&#39;, &#39;yellow&#39;)</pre><h3>4. Lists vs Tuples</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*qqza7uVjG2fdPSJFwctrHQ.png" /></figure><h3>5. Practical Examples</h3><h4><strong>a. Storing a Shopping List (List)</strong></h4><pre>shopping_list = [&quot;milk&quot;, &quot;bread&quot;, &quot;eggs&quot;]<br>shopping_list.append(&quot;butter&quot;)<br>shopping_list.remove(&quot;bread&quot;)<br>print(shopping_list)  # Outputs: [&#39;milk&#39;, &#39;eggs&#39;, &#39;butter&#39;]</pre><h4><strong>b. Storing Geographic Coordinates (Tuple)</strong></h4><pre>coordinates = (40.7128, -74.0060)  # Latitude, Longitude<br>print(f&quot;Latitude: {coordinates[0]}, Longitude: {coordinates[1]}&quot;)</pre><h4><strong>c. Sorting a List</strong></h4><pre>numbers = [4, 2, 9, 1]<br>numbers.sort()<br>print(numbers)  # Outputs: [1, 2, 4, 9]</pre><h4>d. Tuple Unpacking</h4><p>You can assign each element of a tuple to a separate variable.</p><pre>point = (3, 4)<br>x, y = point<br>print(f&quot;x: {x}, y: {y}&quot;)  # Outputs: x: 3, y: 4</pre><h3>6. Key Takeaways</h3><ul><li><strong>Lists</strong> are mutable and versatile, perfect for collections that may change.</li><li><strong>Tuples</strong> are immutable and best for fixed data or when you want to ensure safety.</li><li>Use list methods like append() and remove() for dynamic modifications.</li><li>Tuples are faster and can be used as dictionary keys or constant values.</li></ul><h3>What’s Next?</h3><p>Great work learning about lists and tuples! Tomorrow, on <strong>Day 6</strong>, we’ll expand into <strong>Dictionaries and Sets</strong>, exploring how to store key-value pairs and unique collections of data. See you then! 🚀</p><p>In case if you missed the 4th part, here is the link</p><p><a href="https://medium.com/@aamirshehzad3388/day-4-functions-and-modular-programming-18313ac5115f">https://medium.com/@aamirshehzad3388/day-4-functions-and-modular-programming-18313ac5115f</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81559a4f239b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 4: Functions and Modular Programming]]></title>
            <link>https://medium.com/@aamirshehzad3388/day-4-functions-and-modular-programming-18313ac5115f?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/18313ac5115f</guid>
            <category><![CDATA[python-module]]></category>
            <category><![CDATA[python-parameter]]></category>
            <category><![CDATA[python-combining-function]]></category>
            <category><![CDATA[python-functions]]></category>
            <category><![CDATA[using-modules]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Fri, 13 Dec 2024 05:54:56 GMT</pubDate>
            <atom:updated>2024-12-13T05:54:56.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to Day 4 of the Python 30-Day Journey! Today, we’ll learn how to write reusable and organized code by exploring <strong>functions</strong> and <strong>modular programming</strong>. Functions allow us to encapsulate blocks of code, while modules enable us to organize and reuse code across multiple files. Let’s dive in!</p><h3><strong>1. Defining and Calling Functions</strong></h3><p>Functions are reusable blocks of code designed to perform specific tasks. They are defined using the def keyword.</p><h4>a. Defining a Function</h4><p>The syntax for creating a function:</p><pre>def function_name():<br>    # Code block<br>    pass  # Placeholder (optional)</pre><h4>b. Calling a Function</h4><p>Once defined, you can call a function by using its name followed by parentheses.</p><p><strong>Example:</strong></p><pre>def greet():<br>    print(&quot;Hello, welcome to Python!&quot;)<br><br># Call the function<br>greet()</pre><p><strong>Output:</strong></p><pre>Hello, welcome to Python!</pre><h4>c. Functions with Parameters</h4><p>Parameters allow you to pass data into a function.</p><p><strong>Example:</strong></p><pre>def greet(name):<br>    print(f&quot;Hello, {name}!&quot;)<br><br># Call the function with an argument<br>greet(&quot;Alice&quot;)</pre><p><strong>Output:</strong></p><pre>Hello, Alice!</pre><h4>d. Functions with Default Parameters</h4><p>You can assign default values to parameters.</p><p><strong>Example:</strong></p><pre>def greet(name=&quot;Guest&quot;):<br>    print(f&quot;Hello, {name}!&quot;)<br><br>greet()         # Uses the default value<br>greet(&quot;Bob&quot;)    # Overrides the default value</pre><p><strong>Output:</strong></p><pre>Hello, Guest!<br>Hello, Bob!</pre><h3>2. Parameters and Return Values</h3><p>Functions can return values using the return keyword.</p><h4>a. Returning a Value</h4><pre>def add(a, b):<br>    return a + b<br><br># Call the function and store the result<br>result = add(5, 3)<br>print(result)</pre><p><strong>Output:</strong></p><pre>8</pre><h4>b. Multiple Return Values</h4><p>You can return multiple values as a tuple.</p><p><strong>Example:</strong></p><pre>def get_full_name(first_name, last_name):<br>    return first_name, last_name<br><br># Unpacking the returned tuple<br>first, last = get_full_name(&quot;John&quot;, &quot;Doe&quot;)<br>print(first, last)</pre><pre>John Doe</pre><h4>c. Positional vs Keyword Arguments</h4><ul><li><strong>Positional Arguments:</strong> Values passed in the order of parameters.</li><li><strong>Keyword Arguments:</strong> Specify the parameter name when passing values.</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(&quot;Alice&quot;, 25)             # Positional<br>display_info(age=30, name=&quot;Charlie&quot;)  # Keyword</pre><h3>3. Using Modules</h3><p>Modules are files containing Python code (functions, variables, or classes) that can be imported and reused.</p><h4>a. Importing Modules</h4><p>Use the import keyword to include a module in your program.</p><p><strong>Example: Importing the </strong><strong>math Module</strong></p><pre>import math<br><br>print(math.sqrt(16))  # Outputs: 4.0</pre><h4>b. Importing Specific Functions</h4><p>You can import only the functions you need:</p><pre>from math import sqrt<br><br>print(sqrt(25))  # Outputs: 5.0</pre><h4>c. Importing with Aliases</h4><p>Use as to create an alias for a module or function.</p><pre>import math as m<br><br>print(m.pi)  # Outputs: 3.141592653589793</pre><h4>d. Writing Your Own Module</h4><p>You can create your own module by saving functions in a .py file and importing it.</p><p><strong>Example:</strong></p><ol><li><strong>Create a file </strong><strong>my_module.py</strong>:</li></ol><pre>def greet(name):<br>    return f&quot;Hello, {name}!&quot;</pre><p><strong>2. Use the module in another file</strong>:</p><pre>import my_module<br><br>print(my_module.greet(&quot;Alice&quot;))</pre><h3>4. Combining Functions and Modules: Practical Examples</h3><h4>a. Calculator Program</h4><p>Write a reusable function-based calculator:</p><pre>def add(a, b):<br>    return a + b<br><br>def subtract(a, b):<br>    return a - b<br><br>def multiply(a, b):<br>    return a * b<br><br>def divide(a, b):<br>    if b != 0:<br>        return a / b<br>    else:<br>        return &quot;Division by zero is not allowed!&quot;<br><br># Using the calculator<br>print(add(5, 3))        # Outputs: 8<br>print(divide(10, 0))    # Outputs: Division by zero is not allowed!</pre><h4>b. Working with the random Module</h4><p>Use the random module to generate random numbers.</p><pre>import random<br><br># Generate a random number between 1 and 10<br>random_number = random.randint(1, 10)<br>print(f&quot;Random Number: {random_number}&quot;)</pre><h4>c. Temperature Conversion Module</h4><p>Create a module for temperature conversion:</p><ol><li><strong>temperature.py</strong>:</li></ol><pre>def celsius_to_fahrenheit(celsius):<br>    return (celsius * 9/5) + 32<br><br>def fahrenheit_to_celsius(fahrenheit):<br>    return (fahrenheit - 32) * 5/9</pre><p><strong>2. Use the module</strong>:</p><pre>import temperature<br><br>print(temperature.celsius_to_fahrenheit(0))   # Outputs: 32.0<br>print(temperature.fahrenheit_to_celsius(100)) # Outputs: 37.777...</pre><h3>5. Key Takeaways</h3><ul><li>Functions help you write reusable, modular, and organized code.</li><li>Use parameters and return values to make your functions flexible and dynamic.</li><li>Modules allow you to organize your code into reusable files and take advantage of built-in Python libraries.</li></ul><h3>What’s Next?</h3><p>Great job learning about functions and modules today! On <strong>Day 5</strong>, we’ll explore <strong>Data Structures (Lists, Tuples, and Dictionaries)</strong> to store and manipulate data effectively. See you tomorrow! 🚀</p><p>In case if you missed the 3rd part, here is the link</p><p><a href="https://medium.com/@aamirshehzad3388/day-3-control-flow-conditionals-and-loops-71e53b4f00cb">https://medium.com/@aamirshehzad3388/day-3-control-flow-conditionals-and-loops-71e53b4f00cb</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18313ac5115f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 3: Control Flow — Conditionals and Loops]]></title>
            <link>https://medium.com/@aamirshehzad3388/day-3-control-flow-conditionals-and-loops-71e53b4f00cb?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/71e53b4f00cb</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python-loop]]></category>
            <category><![CDATA[python-condition-if-else]]></category>
            <category><![CDATA[python-practical]]></category>
            <category><![CDATA[python-control-flow]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 06:45:32 GMT</pubDate>
            <atom:updated>2024-12-09T06:45:32.347Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 3: Control Flow — Conditionals and Loops</h3><p>Welcome to Day 3 of the Python 30-Day Journey! Today, we’ll explore how to control the flow of your programs using conditionals (if, else, elif) and loops (for, while). These tools allow you to make decisions and perform repetitive tasks, making your programs more dynamic and efficient. Let’s dive in!</p><h3>1. Conditionals: if, elif, and else</h3><p>Conditionals are used to execute code based on certain conditions.</p><h4>a. The if Statement</h4><p>The if statement runs a block of code only if a given condition is True.</p><p><strong>Syntax:</strong></p><pre>if condition:<br>    # Code to execute if the condition is True</pre><p><strong>Example:</strong></p><pre>age = 18<br>if age &gt;= 18:<br>    print(&quot;You are eligible to vote!&quot;)</pre><p><strong>b. The</strong> else <strong>Statemen</strong>t</p><p>The else block runs when the if condition is False.</p><p><strong>Syntax:</strong></p><pre>if condition:<br>    # Code to execute if condition is True<br>else:<br>    # Code to execute if condition is False</pre><p><strong>Example:</strong></p><pre>age = 16<br>if age &gt;= 18:<br>    print(&quot;You are eligible to vote!&quot;)<br>else:<br>    print(&quot;You are not old enough to vote.&quot;)</pre><p><strong>c. The</strong> elif <strong>Statement</strong></p><p>The elif (short for &quot;else if&quot;) allows you to test multiple conditions.</p><pre>if condition1:<br>    # Code to execute if condition1 is True<br>elif condition2:<br>    # Code to execute if condition2 is True<br>else:<br>    # Code to execute if all conditions are False</pre><p><strong>Example:</strong></p><pre>score = 85<br>if score &gt;= 90:<br>    print(&quot;Grade: A&quot;)<br>elif score &gt;= 80:<br>    print(&quot;Grade: B&quot;)<br>else:<br>    print(&quot;Grade: C or lower&quot;)</pre><h3>2. Loops: for and while</h3><p>Loops let you repeat a block of code multiple times.</p><p><strong>a.</strong> for <strong>Loops</strong></p><p>A for loop iterates over a sequence (like a list, string, or range).</p><p><strong>Syntax:</strong></p><pre>for variable in sequence:<br>    # Code to execute for each item in sequence</pre><p><strong>Example:</strong></p><pre># Iterating over a list<br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>for fruit in fruits:<br>    print(fruit)</pre><p><strong>Using </strong><strong>range() in </strong><strong>for Loops:</strong> The range() function generates a sequence of numbers.</p><pre># Print numbers 0 to 4<br>for i in range(5):<br>    print(i)</pre><p><strong>b.</strong> while <strong>Loops</strong></p><p>A while loop keeps running as long as a condition is True.</p><p><strong>Syntax:</strong></p><pre>while condition:<br>    # Code to execute while condition is True</pre><p><strong>Example:</strong></p><pre>count = 0<br>while count &lt; 5:<br>    print(count)<br>    count += 1  # Increment count</pre><h3>3. Breaking Out of Loops</h3><p>Python provides ways to control the flow inside loops:</p><p><strong>a.</strong> break <strong>Statement</strong></p><p>The break statement stops the loop immediately.</p><p><strong>Example:</strong></p><pre>for number in range(10):<br>    if number == 5:<br>        break  # Exit the loop when number is 5<br>    print(number)</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*aePNTqPibQaZDY04SFJmeA.png" /><figcaption>output</figcaption></figure><p><strong>b.</strong> continue <strong>Statement</strong></p><p>The continue statement skips the current iteration and moves to the next one.</p><p><strong>Example:</strong></p><pre>for number in range(5):<br>    if number == 2:<br>        continue  # Skip printing when number is 2<br>    print(number)</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*aePNTqPibQaZDY04SFJmeA.png" /><figcaption>output</figcaption></figure><p><strong>c.</strong> else <strong>with Loops</strong></p><p>You can use an else block with loops to run code after the loop finishes normally (without a break).</p><p><strong>Example:</strong></p><pre>for number in range(5):<br>    print(number)<br>else:<br>    print(&quot;Loop completed!&quot;)</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*USJnPOf-NG9IXk80rmvEbA.png" /><figcaption>output</figcaption></figure><h3>4. Practical Examples</h3><p><strong>a. FizzBuzz Problem</strong></p><p>Write a program that prints numbers from 1 to 15. For multiples of 3, print “Fizz” instead of the number, and for multiples of 5, print “Buzz.” For numbers divisible by both 3 and 5, print “FizzBuzz.”</p><p><strong>Code:</strong></p><pre>for i in range(1, 16):<br>    if i % 3 == 0 and i % 5 == 0:<br>        print(&quot;FizzBuzz&quot;)<br>    elif i % 3 == 0:<br>        print(&quot;Fizz&quot;)<br>    elif i % 5 == 0:<br>        print(&quot;Buzz&quot;)<br>    else:<br>        print(i)</pre><p><strong>b. Guess the Number Game</strong></p><p>Write a program where the user has to guess a predefined number.</p><p><strong>Code:</strong></p><pre>secret_number = 7<br>while True:<br>    guess = int(input(&quot;Guess the number (1-10): &quot;))<br>    if guess == secret_number:<br>        print(&quot;Congratulations! You guessed it!&quot;)<br>        break<br>    elif guess &lt; secret_number:<br>        print(&quot;Too low!&quot;)<br>    else:<br>        print(&quot;Too high!&quot;)</pre><h3>5. Key Takeaways</h3><ul><li>Conditionals (if, elif, else) allow your program to make decisions based on conditions.</li><li>Loops (for, while) enable you to repeat code for sequences or until a condition is met.</li><li>break and continue give you control over loop execution.</li></ul><p>in case if you missed the 2nd part, here is the link</p><h3><strong>What’s Next?</strong></h3><p>Great work on mastering conditionals and loops! Tomorrow, on <strong>Day 4</strong>, we’ll explore <strong>Functions and Modular Programming</strong>, where you’ll learn to organize your code into reusable blocks.</p><p>See you then! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71e53b4f00cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This is Part 2 of the series 30-Day Python Journey.]]></title>
            <link>https://medium.com/@aamirshehzad3388/this-is-part-2-of-the-series-30-day-python-journey-a71528f57ec3?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a71528f57ec3</guid>
            <category><![CDATA[python-variable]]></category>
            <category><![CDATA[python-syntax]]></category>
            <category><![CDATA[python-data-type]]></category>
            <category><![CDATA[python-assignment]]></category>
            <category><![CDATA[python-basics-course]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 21:32:08 GMT</pubDate>
            <atom:updated>2024-12-05T21:32:08.766Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@aamirshehzad3388/30-day-python-journey-b7e15dc2b148">https://medium.com/@aamirshehzad3388/30-day-python-journey-b7e15dc2b148</a></p><h3><strong>Day 2: Python Basics — Syntax, Variables, and Data Types</strong></h3><p>Welcome to Day 2 of our Python journey! Today, we’ll focus on the core building blocks of Python: understanding its syntax, working with variables, and exploring primitive data types. These concepts form the foundation for everything you’ll do in Python, so let’s dive right in!</p><p><strong>1. Python Syntax Rules</strong></p><p>Python is known for its clean and straightforward syntax, making it easy to read and write. Here are some key rules:</p><p><strong>a. Indentation Matters</strong><br> Unlike other programming languages that use braces ({}) to define blocks of code, Python relies on indentation. For example:</p><pre># Correct<br>if True:<br>    print(&quot;This is indented correctly!&quot;)<br><br># Incorrect<br>if True:<br>print(&quot;This will throw an IndentationError!&quot;)</pre><p><strong>b. Case Sensitivity</strong><br> Python is case-sensitive, meaning variable and Variable are treated as two different names.</p><pre>name = &quot;Alice&quot;<br>Name = &quot;Bob&quot;<br>print(name)  # Outputs: Alice<br>print(Name)  # Outputs: Bob</pre><p><strong>c. Comments in Python</strong></p><ul><li><strong>Single-line comments:</strong> Use the # symbol.</li></ul><pre># This is a comment<br>print(&quot;Hello, World!&quot;)  # This prints a message</pre><ul><li><strong>Multi-line comments:</strong> Use triple quotes (‘’’ or “””).</li></ul><pre>&quot;&quot;&quot;<br>This is a <br>multi-line comment<br>&quot;&quot;&quot;</pre><p><strong>d. Statements</strong><br> Each line of Python code is typically a statement. Use a semicolon (;) to write multiple statements on one line, though it’s not common practice:</p><pre>print(&quot;Hello&quot;); print(&quot;World&quot;)</pre><p><strong>2. Variables and Assignment</strong></p><p>A variable is a placeholder for storing data. You can think of it as a container that holds values.</p><p><strong>a. Creating Variables</strong><br> In Python, you don’t need to declare variables explicitly. Assigning a value to a variable automatically defines it:</p><pre>x = 5<br>y = &quot;Python&quot;</pre><p><strong>b. Variable Naming Rules</strong></p><ul><li>Must start with a letter or an underscore (_), but cannot start with a number.</li><li>Can only contain alphanumeric characters and underscores (a-z, A-Z, 0–9, _).</li><li>Cannot use Python keywords (e.g., if, while, def).</li></ul><p><strong>Examples:</strong></p><pre>valid_variable = 10  # Valid<br>_invalid_variable = &quot;Hello&quot;  # Valid<br>2variable = &quot;Error&quot;  # Invalid: cannot start with a number</pre><p><strong>c. Reassigning Variables</strong><br> Variables in Python can change types dynamically:</p><pre>x = 10  # x is an integer<br>x = &quot;Python&quot;  # Now x is a string</pre><p><strong>d. Multiple Assignments</strong><br> You can assign values to multiple variables in a single line:</p><pre>a, b, c = 1, 2, 3<br>print(a, b, c)  # Outputs: 1 2 3</pre><p>Or assign the same value to multiple variables:</p><pre>x = y = z = &quot;Same Value&quot;</pre><p><strong>3. Primitive Data Types</strong></p><p>Python has several built-in data types that you’ll use frequently. Let’s explore the most common ones:</p><p><strong>a. Numeric Types</strong></p><ul><li><strong>Integer (int)</strong>: Whole numbers (e.g., 5, -10)</li></ul><pre>age = 25</pre><ul><li><strong>Floating-point (float)</strong>: Numbers with decimals (e.g., 3.14, -0.5)</li></ul><pre>pi = 3.14</pre><ul><li><strong>Complex (complex)</strong>: Numbers with a real and imaginary part (e.g., 3 + 4j)</li></ul><pre>z = 2 + 3j</pre><p><strong>b. Text Type</strong></p><p><strong>String (str)</strong>: A sequence of characters enclosed in quotes (single or double).</p><pre>name = &quot;Alice&quot;<br>greeting = &#39;Hello&#39;</pre><p>Strings support a variety of operations, such as concatenation and repetition:</p><pre>full_greeting = greeting + &quot;, &quot; + name<br>print(full_greeting)  # Outputs: Hello, Alice</pre><p><strong>c. Boolean Type</strong></p><p><strong>Boolean (bool)</strong>: Represents True or False.</p><pre>is_active = True<br>is_closed = False</pre><p><strong>d. None Type</strong></p><ul><li><strong>NoneType (None)</strong>: Represents the absence of a value or null.</li></ul><pre>value = None</pre><p><strong>e. Type Checking</strong><br> You can check the type of a variable using the type() function:</p><pre>x = 5<br>print(type(x))  # Outputs: &lt;class &#39;int&#39;&gt;</pre><p><strong>4. Examples and Practice</strong></p><p><strong>a. Working with Variables</strong></p><pre># Assigning values to variables<br>name = &quot;John&quot;<br>age = 30<br>is_student = True<br><br># Printing variables<br>print(name)  # Outputs: John<br>print(age)   # Outputs: 30<br>print(is_student)  # Outputs: True</pre><p><strong>b. Type Conversion</strong><br> Python allows you to convert between data types using built-in functions like int(), float(), and str().</p><pre>x = &quot;10&quot;<br>y = int(x)  # Converts string to integer<br>z = float(y)  # Converts integer to float<br>print(y, z)  # Outputs: 10 10.0</pre><p><strong>c. String Formatting</strong></p><pre>name = &quot;Alice&quot;<br>age = 25<br>print(f&quot;My name is {name}, and I am {age} years old.&quot;)  # Outputs: My name is Alice, and I am 25 years old.</pre><p><strong>5. Key Takeaways</strong></p><ul><li>Python’s syntax is clean and emphasizes readability, with indentation being critical.</li><li>Variables are dynamically typed, meaning they don’t need explicit declarations.</li><li>Python provides several primitive data types, including int, float, str, and bool, which are easy to use and convert between.</li></ul><p><strong>What’s Next?</strong></p><p>Today, you’ve learned about Python’s syntax, variables, and basic data types. Tomorrow, we’ll take things further by exploring <strong>Control Flow: Conditionals and Loops</strong> to make your programs more dynamic and interactive. See you on Day 3!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a71528f57ec3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[30-Day Python Journey]]></title>
            <link>https://medium.com/@aamirshehzad3388/30-day-python-journey-b7e15dc2b148?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7e15dc2b148</guid>
            <category><![CDATA[introduction-to-python]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python30days]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 04:56:30 GMT</pubDate>
            <atom:updated>2024-12-03T04:56:30.152Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the Python 30-Day Journey! Over the next month, we’ll explore the incredible world of Python programming, one step at a time. Whether you’re a complete beginner or looking to strengthen your coding skills, this series is designed to guide you through Python’s essentials, intermediate concepts, and practical applications.</p><p>Each day, you’ll learn something new — from the fundamentals of syntax and data structures to creating web apps, automating tasks, and even diving into data analysis. By the end of this journey, you’ll not only be comfortable writing Python code but also equipped to take on real-world projects.</p><p>So, grab your laptop, get your Python environment ready, and let’s start this exciting adventure together! Day 1 begins now! 🚀</p><h3>Day 1: Introduction to Python and Setting Up the Environment</h3><p>Welcome to Day 1 of our 30-Day Python Journey! Today, we’ll lay the foundation by introducing Python, guiding you through the installation process, setting up your development environment, and writing your very first Python program. Let’s get started!</p><p><strong>1. Overview of Python</strong></p><p><strong>What is Python?</strong> Python is a high-level, interpreted programming language known for its simplicity and readability. Created by Guido van Rossum and first released in 1991, Python has become one of the most popular languages due to its versatility and wide range of applications.</p><p><strong>Why Choose Python?</strong></p><ul><li><strong>Easy to Learn:</strong> Python’s syntax is clear and concise, making it an excellent choice for beginners.</li><li><strong>Versatile:</strong> From web development and data analysis to artificial intelligence and automation, Python is used in various fields.</li><li><strong>Large Community:</strong> A vast community means extensive libraries, frameworks, and resources are available to help you learn and solve problems.</li><li><strong>High Demand:</strong> Python developers are in high demand, offering numerous career opportunities.</li></ul><p><strong>Common Uses of Python:</strong></p><ul><li><strong>Web Development:</strong> Frameworks like Django and Flask.</li><li><strong>Data Science &amp; Machine Learning:</strong> Libraries such as pandas, NumPy, and scikit-learn.</li><li><strong>Automation &amp; Scripting:</strong> Automate repetitive tasks with ease.</li><li><strong>Game Development:</strong> Libraries like Pygame.</li><li><strong>Embedded Systems:</strong> Python can be used in IoT devices.</li></ul><h4>2. Installing Python and IDEs</h4><p>To start coding in Python, you’ll need to install Python itself and choose an Integrated Development Environment (IDE) or a code editor. Here’s how to set everything up.</p><p><strong>a. Installing Python</strong></p><ol><li><strong>Download Python:</strong></li></ol><ul><li>Visit the <a href="https://www.python.org/downloads/">official Python website</a>.</li><li>Click on the latest stable release (e.g., Python 3.x.x).</li></ul><p><strong>2. Run the Installer:</strong></p><ul><li><strong>Windows:</strong></li><li>Double-click the downloaded .exe file.</li><li><strong>Important:</strong> Check the box that says <strong>“Add Python to PATH”</strong> before clicking “Install Now.”</li><li><strong>macOS:</strong></li><li>Open the downloaded .pkg file and follow the prompts.</li><li><strong>Linux:</strong></li><li>Most distributions come with Python pre-installed. To check, open your terminal and type:</li></ul><pre>python3 --version</pre><p>If not installed, use your package manager. For example, on Ubuntu:</p><pre>sudo apt update<br>sudo apt install python3</pre><p><strong>3. Verify Installation:</strong></p><ul><li>Open your terminal or command prompt.</li><li>Type:</li></ul><pre>python --version</pre><p>or</p><pre>python3 --version</pre><p>You should see the installed Python version</p><p><strong>b. Choosing and Installing an IDE/Code Editor</strong></p><p>While you can write Python code in any text editor, using an IDE or a specialized code editor enhances productivity with features like syntax highlighting, debugging tools, and more.</p><p><strong>Popular Choices:</strong></p><ol><li><strong>Visual Studio Code (VS Code)</strong></li></ol><ul><li><strong>Features:</strong> Lightweight, extensible with numerous plugins, integrated terminal.</li><li><strong>Installation:</strong></li><li>Download from the <a href="https://code.visualstudio.com/">official website</a>.</li><li>Install the Python extension:</li><li>Open VS Code.</li><li>Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).</li><li>Search for “Python” and install the extension by Microsoft.</li></ul><p><strong>2. PyCharm</strong></p><ul><li><strong>Features:</strong> Rich features tailored for Python development, powerful debugging.</li><li><strong>Installation:</strong></li><li>Download from the <a href="https://www.jetbrains.com/pycharm/download/">JetBrains website</a>.</li><li>Choose between the <strong>Community</strong> (free) and <strong>Professional</strong> (paid) editions.</li></ul><p><strong>3. Sublime Text</strong></p><ul><li><strong>Features:</strong> Fast, customizable, with a wide range of plugins.</li><li><strong>Installation:</strong></li><li>Download from the <a href="https://www.sublimetext.com/">official website</a>.</li></ul><p><strong>4. Jupyter Notebook</strong></p><ul><li><strong>Features:</strong> Interactive coding environment, great for data science and visualization.</li><li><strong>Installation:</strong></li></ul><p>Install via pip:</p><pre>pip install notebook</pre><p>Launch with:</p><pre>jupyter notebook</pre><p>c. Setting Up Your Development Environment</p><ol><li><strong>Configure Python in Your IDE:</strong></li></ol><ul><li>Ensure your IDE is pointing to the correct Python interpreter.</li><li>In <strong>VS Code</strong>:</li><li>Press Ctrl+Shift+P (Cmd+Shift+P on macOS) to open the command palette.</li><li>Type Python: Select Interpreter and choose the installed Python version.</li></ul><p><strong>2. Create a Project Folder:</strong></p><ul><li>Organize your code by creating a dedicated folder for your Python projects.</li></ul><p>Example:</p><pre>mkdir python-30-days<br>cd python-30-days</pre><h4>3. Writing Your First Python Program</h4><p>Now that everything is set up, let’s write a simple Python program to ensure everything works correctly.</p><p><strong>a. Hello, World!</strong></p><p>The classic first program in any language is the “Hello, World!” program. It introduces you to the syntax and execution of a simple script.</p><ol><li><strong>Using an IDE (e.g., VS Code or PyCharm):</strong></li></ol><ul><li>Open your IDE.</li><li>Create a new file named hello.py.</li><li>Type the following code:</li></ul><pre>print(&quot;Hello, World!&quot;)</pre><p>Save the file.</p><p><strong>2. Running the Program:</strong></p><ul><li><strong>Using the IDE’s Integrated Terminal:</strong></li><li>Open the terminal within your IDE.</li><li>Navigate to the directory containing hello.py.</li><li>Run the script:</li></ul><pre>python hello.py</pre><p>or</p><pre>python3 hello.py</pre><p><strong>Using the Command Prompt/Terminal:</strong></p><ul><li>Open your terminal.</li><li>Navigate to your project folder:</li></ul><pre>cd path/to/python-30-days</pre><p>Execute the script:</p><pre>python hello.py</pre><p>or</p><pre>python3 hello.py</pre><p>3. Expected Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*qsQrSZcJQWFjHJos2uOVXg.png" /></figure><p><strong>b. Understanding the Code</strong></p><p>Let’s break down what’s happening in the hello.py script.</p><ul><li>print(“Hello, World!”): This line tells Python to output the string “Hello, World!” to the console. The print() function is one of Python’s built-in functions used to display information.</li></ul><p><strong>c. Exploring Further: Your First Variables</strong></p><p>To get a glimpse of Python’s capabilities, let’s introduce variables.</p><ol><li>Modify hello.py:</li></ol><pre>greeting = &quot;Hello, Python!&quot;<br>print(greeting)</pre><p><strong>2. Run the Script:</strong></p><ul><li>Execute as before:</li></ul><pre>python hello.py</pre><ul><li>Output:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*VmU0cle9szx0QBeZDqQvJw.png" /></figure><p><strong>d. Saving and Running Scripts</strong></p><p>Remember to save your changes before running the script to see the updated output. Regularly practicing writing and running scripts will help reinforce your learning.</p><p><strong>4. Next Steps</strong></p><p>Congratulations on completing Day 1! You’ve successfully installed Python, set up your development environment, and written your first Python program. Tomorrow, we’ll dive into Python basics, exploring syntax, variables, and data types.</p><p><strong>Stay Curious:</strong></p><ul><li>Experiment with modifying your hello.py script.</li><li>Try changing the message or adding more print() statements.</li><li>Explore your IDE’s features, such as code formatting and debugging tools.</li></ul><p><strong>Resources:</strong></p><ul><li><a href="https://docs.python.org/3/">Official Python Documentation</a></li><li><a href="https://wiki.python.org/moin/BeginnersGuide">Python Beginner’s Guide</a></li><li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python">Visual Studio Code Python Extension</a></li><li><a href="https://www.jetbrains.com/pycharm/learn/">PyCharm Educational Resources</a></li></ul><p>See you soon for Day 2!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7e15dc2b148" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Image Labeling: Unlocking Earning Opportunities in AI and Data Annotation]]></title>
            <link>https://medium.com/@aamirshehzad3388/python-image-labeling-unlocking-earning-opportunities-in-ai-and-data-annotation-1491999f99f1?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1491999f99f1</guid>
            <category><![CDATA[labelimg]]></category>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-labeling-platform]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 06:03:35 GMT</pubDate>
            <atom:updated>2024-12-01T06:03:35.246Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of artificial intelligence (AI) and machine learning (ML), labeled data serves as the foundation for training powerful models. Among various types of data, image data plays a pivotal role in applications like computer vision, facial recognition, autonomous vehicles, medical diagnostics, and more. If you’re interested in leveraging Python programming skills to earn money, <strong>image labeling</strong> offers a lucrative opportunity.</p><p>This article will guide you through the essentials of Python-based image labeling, its applications, tools you can use, and practical ways to monetize your skills.</p><h3>What is Image Labeling?</h3><p>Image labeling is the process of annotating images to identify objects, regions, or features within them. These annotations help AI systems understand visual data. For example, in an image of a dog, you might draw a bounding box around the dog and label it as “dog.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyses8DenHO8oAwD-wxRWA.png" /></figure><p>The annotated images then act as training data for machine learning algorithms. The better the labeling quality, the more accurate the model’s predictions.</p><h3>Common Types of Image Labels:</h3><ol><li><strong>Bounding Boxes</strong>: Rectangular annotations to locate objects.</li><li><strong>Polygons</strong>: Detailed shapes around irregularly shaped objects.</li><li><strong>Segmentation Masks</strong>: Pixel-level annotations for precise identification.</li><li><strong>Keypoints</strong>: Marking specific points (e.g., joints in a human figure).</li><li><strong>Classification Tags</strong>: Assigning labels to entire images.</li></ol><h3>Why is Image Labeling in High Demand?</h3><p>AI models thrive on high-quality data, making data annotation indispensable. With the rise of machine learning applications, the demand for labeled datasets has skyrocketed. Companies and researchers are constantly seeking skilled annotators who can create accurate datasets for tasks like:</p><ul><li>Training autonomous vehicles.</li><li>Enhancing medical imaging software.</li><li>Developing retail product detection systems.</li></ul><p>This growing demand translates to an array of earning opportunities for individuals skilled in image labeling.</p><h3>How to Start Image Labeling with Python?</h3><p>Python, with its vast ecosystem of libraries, simplifies the image labeling process. Here’s how you can get started:</p><h3>1. Install the Required Libraries</h3><p>You’ll need Python libraries like:</p><ul><li><strong>LabelImg</strong>: A graphical image annotation tool.</li><li><strong>OpenCV</strong>: For image processing.</li><li><strong>Pandas</strong>: For managing annotations data.</li><li><strong>Matplotlib</strong>: For visualization.</li></ul><p>Install these using pip:</p><pre>pip install labelImg opencv-python pandas matplotlib</pre><h3>2. Labeling Images with LabelImg</h3><p>LabelImg is one of the most popular tools for creating bounding box annotations. It’s easy to install and use:</p><p>1. Install LabelImg:</p><pre>pip install labelImg</pre><p>2. Launch the tool:</p><pre>labelImg</pre><p>3. Open your image directory and start annotating. Save annotations in XML (PASCAL VOC format) or TXT (YOLO format).</p><h3>3. Automating Labeling with Python</h3><p>For repetitive tasks, you can automate certain aspects of labeling using Python. For instance, OpenCV can help you pre-process images or detect objects, speeding up the manual labeling process.</p><p>Example: Drawing a rectangle around detected objects:</p><pre>import cv2<br><br># Load the image<br>image = cv2.imread(&#39;image.jpg&#39;)<br><br># Convert to grayscale and detect edges<br>gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)<br>edges = cv2.Canny(gray, 50, 150)<br><br># Find contours and draw bounding boxes<br>contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)<br>for contour in contours:<br>    x, y, w, h = cv2.boundingRect(contour)<br>    cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)<br><br># Display the result<br>cv2.imshow(&#39;Labeled Image&#39;, image)<br>cv2.waitKey(0)<br>cv2.destroyAllWindows()</pre><h3>Ways to Earn Money Using Image Labeling</h3><h3>1. Freelancing on Platforms</h3><p>Freelance marketplaces like Upwork, Fiverr, and Freelancer have a steady demand for data annotation services. Clients post projects for labeling datasets, and you can earn by completing these tasks.</p><h4>Steps:</h4><ol><li>Create a profile showcasing your image labeling skills.</li><li>Highlight your Python expertise for automation or quality improvement.</li><li>Apply for projects and deliver high-quality work to build a strong reputation.</li></ol><h3>2. Join Annotation Platforms</h3><p>Several companies offer part-time or full-time roles for image annotators. Popular platforms include:</p><ul><li><strong>Amazon Mechanical Turk</strong></li><li><strong>Appen</strong></li><li><strong>Lionbridge AI</strong></li><li><strong>Scale AI</strong></li></ul><p>These platforms connect annotators with clients who need labeled datasets.</p><h3>3. Offer Custom Labeling Services</h3><p>Start a small business offering customized annotation services. This involves reaching out to AI startups, research labs, or organizations needing specialized datasets.</p><h4>Tools for Efficiency:</h4><ul><li>Use Python to streamline repetitive tasks.</li><li>Leverage tools like LabelImg, CVAT, or VIA for quicker annotations.</li></ul><h3>4. Contribute to Open Source Projects</h3><p>While open-source contributions might not pay immediately, they help you build credibility. Participating in GitHub projects related to data annotation can showcase your expertise to potential employers or clients.</p><h3>5. Build and Sell Labeled Datasets</h3><p>You can create datasets for specific domains (e.g., agriculture, retail, or security) and sell them on platforms like:</p><ul><li><strong>Kaggle Datasets</strong></li><li><strong>Dataset Marketplaces</strong> (e.g., Roboflow, OpenML)</li></ul><p>Creating niche datasets can attract buyers looking for tailored solutions.</p><h3>Tips for Success</h3><h3>1. Prioritize Quality</h3><p>Clients value accuracy over speed. Double-check your annotations to ensure high-quality output.</p><h3>2. Learn Advanced Annotation Tools</h3><p>Expand your toolkit by learning advanced tools like CVAT (Computer Vision Annotation Tool) or Label Studio. These tools support complex annotations and integrations with Python scripts.</p><h3>3. Offer Specialized Services</h3><p>Focus on high-demand domains like medical imaging or autonomous driving. Developing expertise in niche areas can make you stand out.</p><h3>4. Automate Repetitive Tasks</h3><p>Use Python to automate mundane tasks in the annotation process. For example, scripts can help pre-label images or convert annotations between formats.</p><h3>Future Scope</h3><p>As AI technologies advance, the demand for labeled data will continue to grow. The market for specialized annotators with technical expertise in Python and automation tools is expected to expand significantly. By staying updated on trends and improving your skills, you can build a sustainable career in this field.</p><h3>Conclusion</h3><p>Image labeling, powered by Python, is not only a critical step in AI development but also a gateway to earning a stable income. Whether you’re a freelancer, an entrepreneur, or an aspiring ML enthusiast, mastering image annotation tools and techniques can unlock numerous opportunities. Start small, improve consistently, and explore diverse ways to monetize your skills.</p><p>By leveraging your Python expertise and staying dedicated to delivering quality, you can carve out a rewarding niche in the ever-expanding AI ecosystem.</p><p>Would you like to explore more advanced image labeling techniques or Python scripts for automation? Let me know in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1491999f99f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Python: A Beginner’s Guide]]></title>
            <link>https://medium.com/@aamirshehzad3388/getting-started-with-python-a-beginners-guide-dbd660bb8410?source=rss-890eecdf368c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbd660bb8410</guid>
            <category><![CDATA[coding-tips]]></category>
            <category><![CDATA[learn-python]]></category>
            <category><![CDATA[tech-for-beginners]]></category>
            <category><![CDATA[programming-beginner]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Aamir Shehzad]]></dc:creator>
            <pubDate>Fri, 29 Nov 2024 08:47:37 GMT</pubDate>
            <atom:updated>2024-11-29T08:47:37.632Z</atom:updated>
            <content:encoded><![CDATA[<p>Python is one of the most popular programming languages in the world, and for good reason. Its simplicity, versatility, and wide range of applications make it an excellent choice for beginners and professionals alike. Whether you’re looking to dive into web development, data analysis, artificial intelligence, or even just automate repetitive tasks, Python is the tool for the job.</p><p>In this article, we’ll cover the basics of Python to help you take your first steps in the programming world. By the end, you’ll have a strong foundation and a clear path forward to deepen your Python knowledge.</p><h4>Why Learn Python?</h4><p>Before we dive into the technical details, let’s discuss why Python is an ideal starting point for beginners:</p><ol><li><strong>Ease of Learning</strong>: Python has a clean and readable syntax that closely resembles English. This makes it easier for newcomers to grasp the fundamentals of programming without getting bogged down by complex syntax.</li><li><strong>Versatility</strong>: Python can be used in various domains, including web development, data science, machine learning, game development, and more.</li><li><strong>Large Community</strong>: Python has a vast and active community. This means you’ll find plenty of tutorials, documentation, and support to help you along the way.</li><li><strong>Job Opportunities</strong>: Python is in high demand across industries, making it a valuable skill for your career.</li></ol><p><strong>Installing Python</strong></p><p>To start coding in Python, you’ll first need to install it on your system.</p><ol><li><strong>Download Python</strong>: Head over to <a href="https://www.python.org/">python.org</a> and download the latest version of Python. Choose the version compatible with your operating system (Windows, macOS, or Linux).</li><li><strong>Install Python</strong>: Run the installer and follow the instructions. Ensure you check the box that says <em>Add Python to PATH</em> during installation.</li><li><strong>Verify Installation</strong>: Open a terminal or command prompt and type:</li></ol><pre>python --version</pre><p>If Python is installed correctly, you’ll see the version number displayed.</p><h3>Writing Your First Python Program</h3><p>Let’s start with the classic “Hello, World!” program. Open your terminal or an integrated development environment (IDE) like Visual Studio Code, PyCharm, or even Python’s built-in IDLE.</p><p>Type the following code:</p><pre>print(&quot;Hello, World!&quot;)</pre><p>Save the file with a .py extension (e.g., hello.py) and run it in the terminal:</p><pre>python hello.py</pre><p>You should see the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*rOSXkmCa74Tx6B4RbAiznA.png" /></figure><p>Congratulations! You’ve just written your first Python program.</p><h3>Python Basics</h3><p>Now, let’s explore some of the foundational concepts in Python.</p><h4>1. Variables and Data Types</h4><p>In Python, you don’t need to declare the type of a variable. The interpreter determines it automatically.</p><pre># Integer<br>age = 25<br><br># Float<br>height = 5.9<br><br># String<br>name = &quot;Alice&quot;<br><br># Boolean<br>is_student = True</pre><p>You can check the data type of any variable using the type() function:</p><pre>print(type(age))  # Output: &lt;class &#39;int&#39;&gt;</pre><h4>2. Input and Output</h4><p>Python makes it easy to interact with users through input and output.</p><pre># Taking input from the user<br>name = input(&quot;What is your name? &quot;)<br>print(&quot;Hello, &quot; + name + &quot;!&quot;)</pre><h4>3. Conditional Statements</h4><p>Conditionals allow your program to make decisions based on certain conditions.</p><pre>age = int(input(&quot;Enter your age: &quot;))<br>if age &gt;= 18:<br>    print(&quot;You are an adult.&quot;)<br>else:<br>    print(&quot;You are a minor.&quot;)</pre><h4>4. Loops</h4><p>Loops help you repeat actions multiple times.</p><p>· <strong>For Loop</strong>:</p><pre>for i in range(5):<br>    print(&quot;Iteration:&quot;, i)</pre><p><strong>While Loop</strong>:</p><pre>count = 0<br>while count &lt; 5:<br>    print(&quot;Count:&quot;, count)<br>    count += 1</pre><h4>5. Functions</h4><p>Functions allow you to organize your code into reusable blocks.</p><pre>def greet(name):<br>    print(&quot;Hello, &quot; + name + &quot;!&quot;)<br><br>greet(&quot;Alice&quot;)</pre><h3>Working with Libraries</h3><p>One of Python’s biggest strengths is its extensive library ecosystem. These libraries allow you to perform complex tasks with minimal effort.</p><p>Here’s an example of using the math library:</p><pre>import math<br><br># Calculating the square root<br>number = 16<br>print(math.sqrt(number))  # Output: 4.0</pre><h3>Next Steps</h3><p>Now that you have a grasp of the basics, here’s how you can continue building your Python skills:</p><h4>1. Practice Regularly</h4><p>Programming is a skill that improves with practice. Try solving beginner-friendly problems on platforms like:</p><ul><li><a href="https://www.hackerrank.com/">HackerRank</a></li><li><a href="https://leetcode.com/">LeetCode</a></li><li><a href="https://www.codewars.com/">Codewars</a></li></ul><h4>2. Learn About Python Libraries</h4><p>Once you’re comfortable with the basics, explore Python’s popular libraries:</p><ul><li><strong>For Data Analysis</strong>: pandas, numpy</li><li><strong>For Machine Learning</strong>: scikit-learn, tensorflow</li><li><strong>For Web Development</strong>: flask, django</li></ul><h4>3. Work on Projects</h4><p>Start building small projects to apply what you’ve learned. Here are a few ideas:</p><ul><li>A calculator</li><li>A to-do list app</li><li>A weather information scraper using APIs</li></ul><h4>4. Join the Python Community</h4><p>Engage with the Python community to learn from others. Participate in forums like:</p><ul><li><a href="https://www.reddit.com/r/Python/">Python Reddit</a></li><li><a href="https://stackoverflow.com/questions/tagged/python">Stack Overflow</a></li></ul><h3>Conclusion</h3><p>Python is a powerful and beginner-friendly language that opens up endless opportunities. By mastering its basics and gradually working on real-world projects, you’ll be well on your way to becoming a proficient Python developer.</p><p>Remember, the key to learning Python (or any programming language) is consistency and curiosity. Keep experimenting, building, and learning, and you’ll find Python to be an invaluable skill in your personal and professional journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbd660bb8410" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>