Python or C

Hi all,
I am new to codechef and now i am getting deeply interested in solving codechef problems. The question that flutters my mind is that should i prefer python or C for solving. I want to know all the positives and negatives related to both programming languages.
Thank you in advance!

1 Like

Hi @yashozzy.

1)If you are completely new to programming,then i would suggest you take up Python and get familiar with the basic algorithms and stuff and then switch to C++ in 2-3 months. The advantage of Python is that it will give you a kick start in programming contests as you dont have to worry about basic stuff like integer overflow, fast exponentiation, floating point accuracy and other such stuff as the inbuilt functions take care of most off this stuff. Within 1-2 months and a fair bit of practice , you will be able to solve a fair number of questions and learn most of the basics well.

However once you are thorough with the basic part (about 4-5 months for me), you will begin to feel the limitations of Python. Python is a lot slower than C and also question like DP(Dynamic programming), BIT(Binary Indexed Tree) , Segment trees are much more easier to understand and implement in C++ and there is lot more material available for C++. You can switch to C++ at this point.

OR

2)If you have some prior experience in programming directly take up C (preferably C++) and adapt it to contest environment. This might be slow and problematic at the start but will help in the long run.

I have mentioned C++ instead of C because the C++ used in programming contests is basically C only but you get the added advantage of inbuilt functions and libraries in C++. Good luck.

8 Likes

thank you i got you!!

i say both