Python is an interpreted, high-level, general-purpose programming language.
It is elegant and has a design philosophy that emphasizes code readability.
It is a higher level language, that helps you with ease of programming on Advance levels especially for Artificial Intelligence and Machine Learning Algorithms.
C++ is a sophisticated, efficient and a general-purpose programming language based on C.
It is extremely powerful and complex language that requires more discipline as the programmer is responsible of memory management. This feature can be smartly used to manipulate the memory operations.
It gives you alot of control to program on lower and deeper level such as micro-controllers and embedded systems.
Some of the most critical differences are described below:
Python supports garbage collection but C++ does not.
C++ is easier to install as compared to python on windows box.
Python is easier to maintain and object oriented, whereas, C++ is less clean and manageable. But, Python is slower than C++ because it is an interpreted language.
Python runs through an interpreter, while C++ is a pre-compiled language.
In python Variables are accessible even outside the loop. This is not possible in C++.
Python
for i in xrange(1, 6):
print i
vs
C++
for(int i = 1, i <= 6, i++){
cout << i;
}
//not possible to print i outside loop
Let’s have a look at the coding style of both Python and C++. The following code tabs show how “Hello World” can be printed in both the languages.
#include <iostream>using namespace std;int main(){cout << "Hello World";return 0;}
Free Resources