In this page, i have given only one example program to differentiate the size of the code in C compared with python.
Although the “C” program has it’s own strengths, python takes less lines of code for doing things easily. This is possible by importing the related packages or modules.
Let us take to compute the mean, median, mode of an array of numbers in “C”.
If you observe the above code, it takes around ’70’ lines. Now the above work can be done in the python as follows.
There are many open source packages that gives more strength to python.
It is observed that python has less number of lines.
Now there is another package supported in python, with this we can compute the mean, mode and median and other statistical operations with a single line of code.
Observe the following snippet.
The second line here is the package “statistics” should be imported before using the methods in this module.