<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Patrick Dacius</title>
    <description>The latest articles on DEV Community by Patrick Dacius (@patrick_dacius).</description>
    <link>https://dev.to/patrick_dacius</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2449893%2Fcd15b672-c3a9-4bac-a534-ea790906b035.jpg</url>
      <title>DEV Community: Patrick Dacius</title>
      <link>https://dev.to/patrick_dacius</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/patrick_dacius"/>
    <language>en</language>
    <item>
      <title>Ignite with Flask</title>
      <dc:creator>Patrick Dacius</dc:creator>
      <pubDate>Sun, 19 Jan 2025 17:24:01 +0000</pubDate>
      <link>https://dev.to/patrick_dacius/ignite-with-flask-5eni</link>
      <guid>https://dev.to/patrick_dacius/ignite-with-flask-5eni</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Are you new to Python?&lt;/strong&gt; If so, you're looking for some libraries and frameworks that can help you kickstart creating your first of many projects. ****Python is a powerful language that can help you build anything, from automation tools to web apps. In this post, we’ll dive into Flask step-by-step and guide you through installing this framework and setting up your framework to get started for building your very first project. Let’s get started!&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Flask?
&lt;/h1&gt;

&lt;p&gt;Flask is a framework that is written in Python that helps in the aid of the development of an application by providing crucial and necessary back-end components. Not only is Flask a framework but it is also considered a “micro” lightweight framework, this is due to the focus on providing the core functionalities essential for web development without implementing unnecessary components, allowing the ability to enhance customization and performance. When a developer's priority is simplicity, control Flask is the way to go.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why use the Flask framework?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you know a little bit about what Flask is, let's talk about some of the reasons why a beginner like me and yourself should use this framework and its key features.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Lightweight and Minimalistic:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Flask is a micro web framework, as said previously. We are only provided with the tools to get the application we are creating running without having to implement strict/unnecessary additions. This is best used for medium-to-small-sized apps and projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Easy to Learn for Beginners:
&lt;/h3&gt;

&lt;p&gt;Flask has a design that is straightforward. This allows beginners to grasp the fundamentals of Flask and web development more easily. Flask has excellent official documentation with beginner-friendly examples and guides. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. Flexibility and Customization:
&lt;/h3&gt;

&lt;p&gt;Flask is unlike other frameworks. With this framework, you are allowed to use the libraries and extensions of your choice. You have the freedom to decide how to structure your code, handle the database, and manage any user authorization and authentication, etc. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some of the libraries or Flask-specific extensions that are frequently used are:

&lt;ul&gt;
&lt;li&gt;Flask-SQLAchemy for database integration&lt;/li&gt;
&lt;li&gt;Flask-WTF for form validation&lt;/li&gt;
&lt;li&gt;Flask-login for user authentication&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Built-In Development Server and Debugger
&lt;/h3&gt;

&lt;p&gt;Another cool reason to use the Flask framework is due fo the built-in development sever and debugging, which makes the testing and troubleshooting easier during the development of the web application. The debugger allows for the creator to inspect the returned errors directly within the browser. &lt;/p&gt;

&lt;h3&gt;
  
  
  5. Ideal for Prototypes
&lt;/h3&gt;

&lt;p&gt;Because Flask is a lightweight framework, it is perfect for building prototypes and MVPs. It  lets you quickly test the ideas that you have without the effects of a heavy framework &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started With Flask
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites:
&lt;/h3&gt;

&lt;p&gt;Before starting Flask we need to make sure of a few things: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Python Installed&lt;/strong&gt;: Flask is a Python framework, so the use of Flask cannot be done without having Python.&lt;/p&gt;

&lt;p&gt;Check if Python is installed by running:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;(If you don't have Python installed, a simple google search to &lt;a href="http://Python.org" rel="noopener noreferrer"&gt;Python.org&lt;/a&gt; will help you get that problem fixed)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pip (Python Package Installer)&lt;/strong&gt;: Pip usually comes pre-installed with Python but you should always check and verify it by running:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A Code Editor:&lt;/strong&gt; Use a Code editor of your choice to write your Flask code. My code editor of choice is VSCode. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Terminal or Command Line:&lt;/strong&gt; This is to run your Flask application.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step-by-step Guide to Set Up Flask
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Set Up a Project Directory:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Create a new directory for your Flask project and navigate to the project using your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir flask_blog_project
cd flask_blog_project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Virtual Environment:&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A virtual environment helps isolate project dependencies. Run the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m venv venv 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a virtual environment called &lt;code&gt;venv.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Activate the Virtual Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;On macOS/Linux:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On Windows:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;venv\Scripts\activate
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Your terminal should show &lt;code&gt;(venv)&lt;/code&gt; at the start, which indicates the environment is active.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Install Flask:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Install Flask using &lt;code&gt;pip&lt;/code&gt; within the activated virtual environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;import flask; print(flask.__version__)&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a basic Flask Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In your project folder, create a new file called &lt;code&gt;app.py&lt;/code&gt;  with the following code:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;home&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, Blog reader! Welcome to my flask set up.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Run the Flask Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set up &lt;code&gt;FLASK_APP&lt;/code&gt;  environment variable:  &lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- On macOS/Linux:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```
    export FLASK_APP=app
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- On Windows (Command Prompt):
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```
    set Flask_APP=app
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Start the Flask development server:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```bash
    flask run
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2. Open your browser and go to http://127.0.0.1:5000/. You should see:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```css
    Hello, Blog reader! Welcome to my flask set up.
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Add More Routes:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;To make your app dynamic, add more routes. Update your &lt;code&gt;app.py&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/about&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;about&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are on the About Page.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/greet/&amp;lt;name&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;capitalize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- **Restart the Flask server** (Ctrl+C to stop and `flask run` to restart).
- Visit these routes in the browser:
    - http://127.0.0.1:5000/about
    - http://127.0.0.1:5000/greet/yourname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Learn About Templates and Static Files&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Flask supports dynamic HTML rendering using the &lt;strong&gt;Jinja2 templating engine&lt;/strong&gt;. For example:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Create a folder called `templates` in your project directory.
- Inside `templates`, create an `index.html` file:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```html
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Flask App&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Welcome to my application, {{ name }}!&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Update `app.py` to render the template:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```python
from flask import render_template

@app.route('/welcome/&amp;lt;name&amp;gt;')
def welcome(name):
    return render_template('index.html', name=name)
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Restart the Flask server and visit:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:5000/welcome/yourname
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Explore Flask Extensions&lt;/strong&gt;: &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Flask has many extensions to help you add features. Some common ones include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flask-SQLAlchemy&lt;/strong&gt;: For database integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flask-Login&lt;/strong&gt;: For user authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flask-WTF&lt;/strong&gt;: For form handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install an extension using &lt;code&gt;pip&lt;/code&gt;, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;flask-sqlalchemy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>flask</category>
      <category>softwareengineering</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Transitioning from JavaScript To Python: From let to def</title>
      <dc:creator>Patrick Dacius</dc:creator>
      <pubDate>Wed, 04 Dec 2024 17:25:15 +0000</pubDate>
      <link>https://dev.to/patrick_dacius/transitioning-from-javascript-to-python-from-let-to-def-3gbg</link>
      <guid>https://dev.to/patrick_dacius/transitioning-from-javascript-to-python-from-let-to-def-3gbg</guid>
      <description>&lt;h2&gt;
  
  
  Table Of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What Makes Python So Special?:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Popularity&lt;/li&gt;
&lt;li&gt;Versatility&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Python Vs JavaScript: A Syntax Showdown:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Variables &amp;amp; Data Types&lt;/li&gt;
&lt;li&gt;Code Blocks&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Conditionals (If statements)&lt;/li&gt;
&lt;li&gt;Arrays and Objects&lt;/li&gt;
&lt;li&gt;Iteration (For Loops)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Tips and Resources for Python&lt;/strong&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;For a JavaScript developer, Python might feel like an entirely different world—but is it really? I like to think of Python and JavaScript as cousins. They are distinct in their personalities yet undeniably part of the same family, sharing more similarities than you might expect. both are high-level programming languages but the differences lie within their syntax and primary functions. Python excels in offering software engineers a way to code while maintaining simplicity, and readability by relying on indentation to define blocks. Whereas JavaScript relies on curly braces and semicolons which could offer more freedom in one's coding style but may appear less readable.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What Makes Python So Special?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Let's dive into the reasons why I believe Python is so special as a JavaScript developer pivoting to Python as my second language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Popularity
&lt;/h2&gt;

&lt;p&gt;For starters, python is one of the most popular programming languages. In 2023 Python ranked as the #1 coding language passing up other languages like C and Java.&lt;/p&gt;

&lt;p&gt;In 2024 Python has ranked amongst the Top 3 along side C and JavaScript. &lt;/p&gt;

&lt;p&gt;A strong sense of community lies within the Python users as it Ranks as the 1st in terms of most loved language and 2nd in most wanted language based on the Stack-Overflows developer survey in 2023. &lt;/p&gt;

&lt;p&gt;but upon further research, the demand for Python developers within the job market has been very strong. The demand has been in widespread industries such as healthcare, finance, education, tech, and many more. Python's versatility keeps the demand for developers proficient in this language, for reasons we will speak about shortly. &lt;/p&gt;

&lt;p&gt;Here is a photo that collects data from the year 2024 that shows the number of job listings based on the coding language:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkt3zka0riou2687b11zp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkt3zka0riou2687b11zp.png" alt="Image description" width="655" height="491"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we’ve discussed how popular this language is let's dive into the versatility of this language and why this versatility gives any python developer the edge over other languages. &lt;/p&gt;

&lt;h2&gt;
  
  
  Versatility
&lt;/h2&gt;

&lt;p&gt;Like JavaScript Python can be used for Web development, but what separates Python from javascript making it the more special coding language is being able to widen the range of possibilities in things you can achieve such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Science and Machine Learning:&lt;/strong&gt; Python has powerful tools like Pandas, NumPy, and scikit-learn, which make it the best language for working with data and building machine learning models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automation and Scripting:&lt;/strong&gt; Python is easy to use, making it great for automating repetitive tasks, like gathering data from websites or managing computer systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scientific Computing and Research:&lt;/strong&gt; Python’s easy-to-read code and a strong set of libraries make it a popular choice for research and academic projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Artificial Intelligence and Robotics:&lt;/strong&gt; Python is widely used in AI and robotics because it’s simple to write and read, and has many helpful libraries like TensorFlow and Keras, plus a large community to support it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Python vs JavaScript: A Syntax Showdown
&lt;/h1&gt;

&lt;p&gt;As I mentioned earlier, I like to think of JavaScript and Python as cousins. They are similar but each with its unique personality.  they may look different on the surface, but they both share a lot of common traits. In this section, I will provide visual code blocks that will display these differences and similarities. &lt;/p&gt;

&lt;h3&gt;
  
  
  Variables &amp;amp; Data Types
&lt;/h3&gt;

&lt;p&gt;In Python, all variables are declared by setting a name without the &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt; keyword which is different from JavaScript. Python adopts the snake case naming convention seen in the code block when creating the &lt;code&gt;is_active&lt;/code&gt; boolean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Python:&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzutd63j034u5c1ka8x3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzutd63j034u5c1ka8x3.png" alt="Image description" width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;JavaScript:&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt4rf1p56qll97dppxie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt4rf1p56qll97dppxie.png" alt="Image description" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Blocks
&lt;/h3&gt;

&lt;p&gt;As you can see JavaScript uses curly braces to determine the code blocks, but in Python code blocks are determined by the indentation. Python’s use of indentation promotes clean and readable code.  &lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmtqs1zk9pvt2prxh1i6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmtqs1zk9pvt2prxh1i6.png" alt="Image description" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7hd91npdxeba2il6xoi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7hd91npdxeba2il6xoi.png" alt="Image description" width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Functions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In Python, functions are declared using the &lt;code&gt;def&lt;/code&gt; keyword. JavaScript uses &lt;code&gt;const&lt;/code&gt; or &lt;code&gt;function&lt;/code&gt; keyword to define functions but both languages use &lt;code&gt;return&lt;/code&gt; to get the values from each function.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9bf3stjjdrf7wricz5rc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9bf3stjjdrf7wricz5rc.png" alt="Image description" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F807a5qtvj33lnq964rd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F807a5qtvj33lnq964rd3.png" alt="Image description" width="738" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conditionals (if statements)
&lt;/h3&gt;

&lt;p&gt;Python only uses &lt;code&gt;==&lt;/code&gt; for equality comparison. Whereas JavaScript uses &lt;code&gt;===&lt;/code&gt; for strict comparison (checks value and type). JavaScript uses curly braces to establish code blocks whereas Python uses indentation. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zcin0cye4kfpks9hy5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zcin0cye4kfpks9hy5e.png" alt="Image description" width="652" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvo2u0lhiub46vyfsxvj7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvo2u0lhiub46vyfsxvj7.png" alt="Image description" width="774" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Arrays and Objects&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5x1fmw4yug4yw12rqx7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5x1fmw4yug4yw12rqx7l.png" alt="Image description" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesv2vkbvelom0mi78ptg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesv2vkbvelom0mi78ptg.png" alt="Image description" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both Python (lists) and JavaScript (Arrays) use these to store data in an ordered sequence, but Python’s lists are used more flexibly, while JavaScript arrays are optimized for performance.  Let’s talk about Objects In each language now...&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5nu9dhieimxzsydefbh6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5nu9dhieimxzsydefbh6.png" alt="Image description" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qs17lefwu7vfcuh6827.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qs17lefwu7vfcuh6827.png" alt="Image description" width="800" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;br&gt;
You access values in a dictionary using square brackets and the key inside. For example, &lt;code&gt;student['name']&lt;/code&gt; retrieves the value associated with the key &lt;code&gt;'name'.&lt;/code&gt;&lt;br&gt;
You can use any immutable type, like strings, numbers, or tuples, as a dictionary key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
You access object properties using dot notation &lt;code&gt;([student.name](http://student.name/)&lt;/code&gt;) or square brackets &lt;code&gt;(student['name'])&lt;/code&gt;.&lt;br&gt;
Object keys are always strings or symbols, even if you use a number or other type (they get converted to a string).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Iteration (Loops)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8el7gdhl5gcevxl9ceo0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8el7gdhl5gcevxl9ceo0.png" alt="Image description" width="478" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fbfuqqktp3dr6v102xe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fbfuqqktp3dr6v102xe.png" alt="Image description" width="514" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In JavaScript, &lt;code&gt;for&lt;/code&gt; loops make use of the traditional counter &lt;code&gt;(let i = 0)&lt;/code&gt;, while Python uses the &lt;code&gt;range()&lt;/code&gt; to carry out the iteration over a sequence of numbers. &lt;/p&gt;

&lt;p&gt;As you can see Python has a more readable loop, and removes the need for managing the counter variable manually when creating a loop.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tips and Resources for Python
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Tips:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As a JavaScript developer, I was a bit nervous about how difficult it would be to learn and implement a new language into my arsenal. I know how nerve-racking It was for me and I would like to help eliminate all of those nerves by providing you with some tips and resources that helped me push through.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leveraging your knowledge In JavaScript. I learned that concepts are typically the same across coding languages in regard to the essentials. The major differences usually lie within the syntax and built-in features. -&lt;/li&gt;
&lt;li&gt;Utilizing Codecademy, and FreeCodeCamp if able. FreeCodeCamp provides a full Python course on YouTube which is a great start.&lt;/li&gt;
&lt;li&gt;something as simple as looking at code within the new language you’re learning. Taking the time to look at code in your new language can help you pick on some things faster than going through some step-by-step lessons.&lt;/li&gt;
&lt;li&gt;Solving Code Challenges (on leetCode or NeetCode) in your strongest language then converting it into the new language you're trying to learn. Converting this code could mean trying to solve it yourself in the new language or just looking up the solution in your new language and trying to understand why it works the way it does.&lt;/li&gt;
&lt;li&gt;Try to build a small project while making small but good progress in your understanding of the new language.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With all that being said here are some resources that I’ve used to help me along this journey! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Resources:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=s3KhqPjBPaQ&amp;amp;t=3228s&amp;amp;ab_channel=NeetCode" rel="noopener noreferrer"&gt;NeetCode Python for Beginners - Full Course&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=ix9cRaBkVe0&amp;amp;t=1216s&amp;amp;pp=ygUbYnJvIGNvZGUgcHl0aG9uIGZ1bGwgY291cnNl" rel="noopener noreferrer"&gt;Bro Code Python Full Course for free 🐍 (2024)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/learn/scientific-computing-with-python/" rel="noopener noreferrer"&gt;freeCodeCamp.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.codecademy.com/enrolled/courses/learn-python-3" rel="noopener noreferrer"&gt;Codecademy Learn Python 3 | Codecademy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>python</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
