DEV Community

Cover image for C++ vs Python
Konchada Sai Ansul
Konchada Sai Ansul

Posted on • Edited on • Originally published at saiansul.hashnode.dev

C++ vs Python

Hello Guys, Welcome back to another post of Sai Ansul's Blog.
In this blog we are gonna find which programming language is better.

So let's start,

Firstly let us know what is programming?

Programming is the way we can make the computer perform various tasks.

What is programming language?

It is a formal language to perform various tasks, there are several protocols and algorithms to be followed.

Let us know the types of programming languages:

  • Procedural Programming Language.
  • Functional Programming Language.
  • Object-oriented Programming Language.
  • Scripting Programming Language.
  • Logic Programming Language.

Some names of programming language are:

  • C++ Language.
  • C Language.
  • Pascal Language.
  • Python Language.
  • Java Language.
  • Perl Language
  • Lisp Language

So, now lets us know something about both the programming language:

C++

White Photo Gaming YouTube Thumbnail.png
It is programming language used for building high level programmed applications, developed by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". C++ supports different ways of programming like: object-oriented, functional, procedural and more.

Python

image.png
It is a programming language, it's object oriented, it's a interpreter language which is easy to learn. This can be used for software and web development also for data science.

Now let us know some of the of the difference between two programming language

C++ Python
It is statically typed It is dynamically typed
No scope as an backend developer Good option for backend developer
Need to write a lot of lines of code Less lines of codes required
It is pre; compiled It uses interpreter
Looks messy but manageable as compared to python It is easy since its object-oriented and simpler to use
C++ is faster than python Python is slower because it uses interpreter, it also determines on the type of data while running
It doesn't support garbage collection It supports garbage collection
TIOBE rating is 4 TIOBE rating is 3
Variables are limited within loops Variables are also accessible outside loops
Rapid Prototyping not possible because of larger code size Rapid Prototyping is possible because of the small size of the code
Not easy in contrast to Python because of its complex syntax. Program is easier to type

These were some of the differences between these 2 programming language.

Now let us know some advantage & disadvantages of Python & C++

image.png

Advantages of Python

  • Its portable
  • Its free and open sourced
  • Easy to use and fast to develop language
  • It has all the libraries that each requires

Disadvantage of Python

  • Speed is slower than C++
  • There are sometimes runtime errors
  • Its not a good choice for mobile development
  • Its used for functional programming
  • Its not a good choice for memory intensive tasks

Advantages of C++

  • It is also portable
  • Object oriented
  • Low-level Manipulation
  • Memory Management

Disadvantages of C++

  • It does not have any security feature
  • It can't support garbage collection
  • Difficult to debug while used for web applications
  • It becomes complex while in a very big and high level programming

So, since we have covered what is python & C++, its difference and its advantages and disadvantages.

Now lets proceed towards the conclusion

So, if you have read this, you might have a clear idea about which programming language is better and which one you should use.
Python is better beginners because of its easy code and syntax, its a good for who want to choose their career in backend web development.
Python is also leading language for data analytics and machine learning .
But, if you want to develop applications or software then C++ is a good programming language to go for.

Now, at the end you have to decide for what purpose which one you have to choose.

Top comments (17)

Collapse
 
danidiaztech profile image
Daniel Diaz

Nice article, but I think you should rename the article from

C++ vs Python
to
Comparison between Python and C++

That's because the title seems you are confronting these two languages and as we know there isn't a better language than other šŸ˜

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul

Thanks for suggesting,
I'll keep this in mind in the next comparison article šŸ˜„

Collapse
 
whippingdot profile image
Sanjaay R.

Very good article. The main reason I am happy is because you are not a python nerd and you are not biased!

You also didn't choose for us, and let us choose, thought that can be frustrating for some people...

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul

Thanks a lot!

I'm glad you found this interesting šŸ˜„

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

Is this an April Fools article that got scheduled to post incorrectlyā€¦ ?

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

I apologize, I literally thought it was an amusing and clever way to name the article and then leave some things out to upset C++ folks. The author didn't seem stupid or wrong to me, just like he was having some good natured fun.

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul • Edited

Thank you for checking my article. I'm glad that you took the time to point that out in such an elegant manner.

It was helpful

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

Concerning your point that Python doing functional programming as a "con," I'm a bit confused. Did you mean imperative? It is easy to write overly imperative Python, which is a good point, but I'm confused what you mean with functional.

Collapse
 
biffbaff64 profile image
Richard Ikin

No scope for backend development with C++???

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul

There are scopes, but python has much more scopes compared to C++.

Collapse
 
biffbaff64 profile image
Richard Ikin

Oh, I know, but C++ is a language that should never be underestimated.

 
james_palermo_bc208e463e4 profile image
James Palermo

I agree entirely.

Collapse
 
miloszstx profile image
Miłosz Gałganek

Good read, you could also check out this resouruce: pythonvs.com/cplusplus

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul

Sure!

Collapse
 
cmuralisree profile image
Chittoji Murali Sree Krishna

Nice info, good work šŸ‘

Collapse
 
saiansulsblog profile image
Konchada Sai Ansul

Thank you so much

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

It left out a lot of stuff in the pros and cons that made me assume it was on purpose to tease the C++ fanboys.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.