Table Of Contents
- Introduction
-
What Makes Python So Special?:
- Popularity
- Versatility
-
Python Vs JavaScript: A Syntax Showdown:
- Variables & Data Types
- Code Blocks
- Functions
- Conditionals (If statements)
- Arrays and Objects
- Iteration (For Loops)
- Tips and Resources for Python
Introduction
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.
What Makes Python So Special?
Let's dive into the reasons why I believe Python is so special as a JavaScript developer pivoting to Python as my second language.
Popularity
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.
In 2024 Python has ranked amongst the Top 3 along side C and JavaScript.
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.
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.
Here is a photo that collects data from the year 2024 that shows the number of job listings based on the coding language:
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.
Versatility
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:
Data Science and Machine Learning: 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.
Automation and Scripting: Python is easy to use, making it great for automating repetitive tasks, like gathering data from websites or managing computer systems.
Scientific Computing and Research: Python’s easy-to-read code and a strong set of libraries make it a popular choice for research and academic projects.
Artificial Intelligence and Robotics: 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.
Python vs JavaScript: A Syntax Showdown
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.
Variables & Data Types
In Python, all variables are declared by setting a name without the let
or const
keyword which is different from JavaScript. Python adopts the snake case naming convention seen in the code block when creating the is_active
boolean.
Code Blocks
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.
Functions
In Python, functions are declared using the def
keyword. JavaScript uses const
or function
keyword to define functions but both languages use return
to get the values from each function.
Conditionals (if statements)
Python only uses ==
for equality comparison. Whereas JavaScript uses ===
for strict comparison (checks value and type). JavaScript uses curly braces to establish code blocks whereas Python uses indentation.
Arrays and Objects
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...
Python:
You access values in a dictionary using square brackets and the key inside. For example, student['name']
retrieves the value associated with the key 'name'.
You can use any immutable type, like strings, numbers, or tuples, as a dictionary key.
JavaScript:
You access object properties using dot notation ([student.name](http://student.name/)
) or square brackets (student['name'])
.
Object keys are always strings or symbols, even if you use a number or other type (they get converted to a string).
Iteration (Loops)
In JavaScript, for
loops make use of the traditional counter (let i = 0)
, while Python uses the range()
to carry out the iteration over a sequence of numbers.
As you can see Python has a more readable loop, and removes the need for managing the counter variable manually when creating a loop.
Tips and Resources for Python
Tips:
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.
- 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. -
- Utilizing Codecademy, and FreeCodeCamp if able. FreeCodeCamp provides a full Python course on YouTube which is a great start.
- 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.
- 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.
- Try to build a small project while making small but good progress in your understanding of the new language.
With all that being said here are some resources that I’ve used to help me along this journey!
Resources:
NeetCode Python for Beginners - Full Course
Top comments (0)