Python for Javascript Developers
Published: 2024-07-08 14:01:38


![Knights from monty python and the holly grail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6utbp4osdmueji1b8zyi.png)

##Why Learn Python in the First Place?
In today's world, we have an abundance of options for languages, and at times it can become overwhelming. So why Python out of all languages? Python is number one on the list of most used programming languages. It is used by companies all around the world.

![graph of most used programming languages in 2024](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rly48mqeksysydalaa8p.png)

> Python is used by Intel, IBM, NASA, Pixar, Netflix, Facebook, JP Morgan Chase, Spotify, and a number of other massive companies. It's one of the four main languages at Google, while Google's YouTube is largely written in Python. The same goes for Reddit, Pinterest, and Instagram. The original BitTorrent client was also written in Python. It is used as a scripting language to control Maya, the industry standard 3D modeling and animation tool.        ~ Brainstation.io


### Quick History on Python!
Python, one of the world's most popular programming languages, was conceptualized by Guido van Rossum in the late 1980s as a successor to the ABC programming language. Python was designed to be easy to learn and use, with support for exception handling and initially targeted at the Amoeba operating system. The first version, 0.9.0, was released in 1991, featuring essential elements like classes, functions, and data types such as lists and dictionaries. Python 1.0, released in 1994, introduced functional programming tools like lambda, map, filter, and reduce, contributed by other developers. Van Rossum continued developing Python at the Corporation for National Research Initiatives (CNRI) in Virginia, where he promoted programming accessibility through the initiative "Computer Programming for Everyone."

In 2000, the Python development team moved to BeOpen.com, transforming Python into a more open-source project with the release of Python 2.0, which fostered greater community involvement. This transition marked a significant change in Python's development process. Python 3.0, released in December 2008, was a major revision that was not backward compatible with Python 2.x, focusing on removing redundant constructs and modules to provide a more streamlined language. Despite the challenge of transitioning from Python 2 to Python 3, with support for Python 2.7 ending in 2020, Python continues to evolve and remains a highly popular and accessible programming language for beginners and professionals alike. Okay now that we got that out the way lets talk code!

##Essential Context and Syntax
For JavaScript developers, learning Python can be a smooth transition thanks to similarities in syntax and logic. However, there are also notable differences. Let's explore the essential context and syntax to get you started.

One of the first things I noticed about python is the readability. lets take a look at the example below 
### Javascript Example

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vv0lkx7lf0amiuwuwrw.png)
### Python Example

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ksrqv7lhfvoxawv575x9.png)

---
While both are fairly short pieces of code, the python example is shorter by a considerable amount of characters and python also has the added benefit of being english readable.

### Variables and Data Types

Variables in Python do not require a keyword for declaration (like var, let, or const in JavaScript). Plus, Python has dynamic typing, making it flexible and easy to use.

### JavaScript Example:
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3juq87btn0snq6ilxaq.png)
### Python Equivalent:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wd5q28y9mj54mux8ejjj.png)
### Functions and Loops
Defining functions in Python is straightforward, using the def keyword. Loops in Python are also quite similar but use a different syntax.

### JavaScript Example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9nqagdzdq4uw2tyqdfr.png)
### Python Equivalent:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b8vl1toipqbmevy5tsg.png)
### Lists and Dictionaries (Arrays and Objects)
   
Python lists and dictionaries are similar to JavaScript arrays and objects, making data manipulation easy and intuitive.

### JavaScript Example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yexnsiyj3wgea9sg3vem.png)
### Python Equivalent:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rm9ct917c1ee6ww3ypcf.png)
## Conclusion
Learning Python as a JavaScript developer is like adding a new superpower to your coding arsenal. It's simple, readable, and used by companies in every field out there. Python's flexibility, readability, and extensive library support make it an excellent choice for web development, data science, machine learning, automation, and more. Lastly don't forget that python is for the girls :)
![Guido Van Rossum wearing a shirt that says python is for girls](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9l5zxmcz3ggzu91ntmg4.png)