Why should I learn Python if I already know Javascript?

I’ve been working with javascript for a while now and I’m comfortable with it. I like all the libraries and flexibility that I have with it. (Typescript, Node, Electron, React, etc)

I want to eventually start messing around with another language like Python or even Java but I’m not really seeing much of what something like python adds that I can’t really already do in javascript.

Can someone explain to this noob why I should start learning Python (or Java)?

1 Like

If you’re thinking about moving into Data Science, Python is pretty much a must. Even if you’re mostly going to stay with web dev, Django (once you get used to it) is really nice to work with in terms of out-of-the-box usability. In short, Python gives you some brilliant options.

1 Like

That’s a bit like saying “why would I buy a hammer when I already own a screwdriver?” They’re different tools.

Funny how after all the answers i no one has given me a straight answer. Different tools. Great. Python is cleaner. Awesome. Building CLIs? NodeJs. What can python do that Js cant do. . Examples

You can bully just about any language into doing just about anything, but it may be a bad choice. Some things that you would use Pyhon for instead of JavaScript would be writing scripts for automation, math-intensive applications, or certain types of games. Whether you specifically want to learn Python (or C or Rust or Java etc) depends on what you are interested in doing, but the fact that you already know JavaScript doesn’t have much to do with that.

1 Like

You didn’t mention ES6 JavaScript, or ES7/ES8, so if you don’t know those yet, that’s definitely worth learning.

While Python and JavaScript do some have differences, and cater to different applications (AI/ML/CV and data science for Python, and web apps for JavaScript), personally I’d recommend not bothering with Python if you already know JavaScript. I consider the two to be more similar than different—they’re both fairly high-level languages, neither is especially performant, and they share a lot of the same concepts. The only huge difference that Python has from JavaScript is that it supports classical OOP (Object-Oriented Programming)—which is notable, but doesn’t provide a huge incentive to learn it.

If you’re looking for another language to learn, I’d recommend one of the following instead:

  • C, C#, or Java (take your pick): these languages provide more of a difference from JavaScript than Python does, largely in part due to their syntax. While all 4 languages do share general syntactical similarities, C/C#/Java are all strongly & statically typed and are more “rigid” in what they allow and don’t allow. C# and Java are fully OOP languages and are very common in the enterprise world—if you ever want to work for a large company, chances are good that they’re using one of the two. C is a good language to learn, even if it has limited applicability to web development, because of how low-level it is. It’ll force you to understand how the CPU and memory work and how to write code that’s performant—which is important in any language, but you won’t really learn how to do that unless you learn C.
  • Golang, Elixir, Haskell, Clojure: the next wave of trendy languages to learn, suitable for back-end development. Golang and Elixir have been increasing in popularity over the past couple years, although I might say Golang is more popular than Elixir right now. Both languages are incredibly performant at scale, and are getting increasingly popular with startups and small companies. Haskell and Clojure are both fairly niche, but provide an alternate view into functional programming that’s worth learning.
  • Swift or Kotlin: Well, only if you want to learn native mobile development—Swift for iOS, or Kotlin for Android. Otherwise you can get away with mobile development using frameworks like React Native.
  • SQL: not a programming language per se, but still a valuable language in 2019, and relational databases are still the dominant type of database today. It’s inevitable that you’ll probably end up using it at some point, and it’s one of the simplest languages to learn.