Well Well here is a déjà vu ( a feeling of having already experienced the present situation ).
You must be thinking when i had such an experience in past. So let’s go back in time when you were born.
A newly born baby can be considered as a new Programmer who wants communicate with this world( Machine ). But we as baby has never given thought to what should be our protocol or rules in which we should start. There are countless number of languages in world in which people communicate , But we learned the one which are parents used to speak , So here you were a kind of a seeker , what environment gave you , you accepted that and that’s why you were never confused at that time which language you should start with.
In in Indian society we start our time with our regional languages and in latter stages your parents start saying okay baby now you have to focus on your English speaking skills , so you were like why haven’t you taught me that on first place ? Well actually your parents maybe don’t know how to speak in English( This was the case with my parents ) , But world is fast growing place where priority of culture changes with time . So here you are reading this that means you know more then one language isn’t that cool . So now lets jump into our computer world.
So now you have to be seeker and your environment is going to be resources that are available to you . Actually scarcity of some resources will be always there because of popularity of some resources. If you are diving in as programmer and want to start with competitive programming ( CP ) you should go for language who’s resources are easily available. What does this term resources means By the way ?? Well in what language people usually write programming blogs , In which language editorials are written usually , In which language tutorials are written usually . So this made it easy for us and to choose.
c++ is a widely used languages among competitive programmers and resources in this language has no limit So i would say take a deep breath and dive into it.
With time when you shift your self with developing field you will see scarcity in resources of c++ because of popularity of python . So that time you going to learn you next language same way you learned English , and this time it’s going to be easy as we are very well aware of components that languages are made up of , due to your prior experience with c++ , So you just have to deal with different syntax now.
So i would recommend you to start with c++ if you are entering CP field or programming field and start with python if you entering into developing field , such as ML , Web development , etc .
Hey buddy!
That is the same question I asked when I started and the answer is really simple. The answer is a little long and sorry for that but I think if you read complete then you won’t be confused anymore.
Go with the language you think is beneficial in long run. If you start coding then it is obvious you are not doing that for only fun. You must have some future goals in mind. Like when I started a few months ago, I had to take Python as a subject in school but I knew I wouldn’t be able to give much time to it due to pressure of preparation for IIT-JEE(you would know it if you are Indian else just know that it takes everything you have to crack it). I have to start class 11th next year and I started with a thought of just doing till class 12 syllabus but I fell in love with the language. Its simplicity is amazing compared to other languages. Now I do competitions on Code Chef regularly.
So long story short see what language is gonna help you. If you have job perspective in mind then see which field you want to go in. Their are different languages in demand for different things.
And if you really don’t have any goal right now and just want to learn to code and go where it takes you then go with Python.
Python is much simpler language compared to other languages though no language is hard. You will find it easier to get started with Python.
Also Python is much closer to english than other language. See the example below:
suppose you have a list and want to make a for loop which does executes a block of code for each element of the list, the following code works:
for x in list_of_numbers:
your code
or if you have a boolean variable(which has a value True or False) named run and want to run a block of code as long as it is True, it is as simple as this:
while run:
your code
so you see Python is easier to understand for others in most cases than other languages though if your code is meant to be seen by others you should always add comments.
Also once when you are good with any one language, picking up another is very very easy. You know how programming works. You just need to know syntax of the new language.
I hope you understood and will chose which language to start with wisely.
Thanks a lot for sharing your views towards this topic , AJ coder. Yeah python is much closer to English.
For CP , resources in c++ are limitless and we can easily self learn c++( I also did it myself ) so particularly in this field ( CP ) i would recommend you to start with c++
More or Less start with something you will find your way as there are lots of destinations.
@pst10 I agree.
start with whatever you like. If you actually work towards it, you will reach a goal. Now days more and more languages are getting more resources to learn from. For popular languages like Java, C, C++ and Python, sky is the limit in self-learning and if you get a good mentor then nothing is better.
Like @pst10 learned C++ through self learning, I learnt Python through self-learning. My school doesn’t really care much about any subject except Science and Maths so I don’t get any help in coding from school(My computer teachers also don’t know much about programming).
Also when you chose a new language keep in mind that each language has different purpose for a reason.
Actually after starting with Python, when I got comfortable with it and started competitive programming, I often got TLE as a result and when I checked codes of others who had comments in C++ codes after the competitions got over, I had TLE for exact same logic. Then after some google research I got to know Python is meant to make development faster and not to be faster. C++ can be upto 5 times faster than Python depending on program.
so if you go with Python, you will have to learn to do simplest of things with the least possible processes and sometimes it is possible(very rarely) that it is not possible to do the question with provided time limit in Python.
But you should see what appeals more to you and just go for it.
Don’t ask others as 1000 people will give 1000 different advice
Yes, python is much slower than C++ but I feel that in time based contests where you have to write code fast, it may be helpful to use Python. Codechef, in particular, recognizes Python is slower and allows 5 times the time limit for C++ for solutions submitted in Python, I believe. I’m not sure if other CP platforms do this as well.
Thus, I feel the slowness of a Python solution is appropriately compensated for and it can be used in CP, instead of having to go learn a completely new language in C++.
@tanmay_garg I didn’t say to go and learn C++ for CP. I myself code in Python only and I love it but I don’t think that Code Chef keeps different time limits for different languages. It might be there in select competitions with only 3-4 allowed languages but in majority of contests lots of languages are allowed and each language has different speed so they don’t keep different time limits.
And I agree that coding in python takes less time and I said that earlier also that Python is meant to make development fast and not to be fast.
Everyone has different favorite language and mine is Python. Actually I started off with C in class 8 but had to leave it after 1 month of programming only and in that time school first teaches algorithms and flow charts, etc. We only started with basic syntax and I remember how to write most basic codes in C but Python is so easy compared to it.
May be just love and easy writing is not the question here what about resources you get in c++ when you are doing CP.
For example almost every website provide code for topics in c++ for sure , Even in editorials , most of the time solutions are given in c++ . For example editorials of codechef and codeforces.
Most famous websites for learning DSA also uses c++ most of the time (Eg: cp-algorithms) , and having code in your preferred language and lots of theory about topic boosts your learning process.
I would also recommend beginners to start with DSA learning series provided by codechef it’s really helpful even i also started from there.
Yes exactly! You’re right, but I do think Codechef gives more time for TLE in Python (5 seconds when limit is written as 1, 10 when 2 is written). Also, after some experimenting, I saw that when the limit in Python was 5, it was 2 seconds in PyPy 3. Could someone confirm if I am right or not?
@tanmay_garg maybe codechef provides more time but it isn’t obviously stated somewhere so I didn’t know. And @pst10 I understand that C++ has too many resources compared to Python3 but consider the fact that C++ is much older and Python is newer. Still Python is the hottest language in market right now. And resources for Python are also not less. I think Python is a highly successful language seeing the heights it reached in the time it had in market till now. Big applications like Spotify are also written in Python. I think if someone is not interested in programming after CP and just learning for sake of learning and CP then they can go with C++but for any other thing, C++ does not make sense now days. Different language is needed for different things but Python is hottest.
This trend keeps on changing and who knows which language will be hot in next 30-40 years. Any language takes time to lose its complete value but new languages come and replace old ones for big tasks very fast.
And just in case anyone thinks, I am not trying to argue or to give biased answers.
I am just trying to tell my opinion.
And like I said earlier - The answer to the topic of this post - Don’t ask others. See what really makes sense to learn for you. If you want to go into web development then you will need Django not Java or C++. If you need to go in Data Science then you will need Python or R(again not Java or C++). There are few industries that still need Java but it is also disappearing day by day. If you want to go only in CP then see which language you can easily get comfortable with because only basics seems super easy in any language. Things start to get complicated as you go(even in Python). So choose wisely instead of listening to others. For the speed of language, if someone tells you to do something in certain language then they are aware of speed and you shouldn’t worry about that. Like @tanmay_garg said, the time limit is given more for slower languages.
If you have some free time, go through the editorial of PPDIV of April Long Challenge 2020. It’s setter has explicitly stated that it is not necessary that every question should be solvable in Python.
For, CP , C++ > Python
Period.
I have one argument against Python here.
Python is not preferred for Web Development that much honestly.
JS does the job and it’s much faster.
Python is good for prototyping and Data Science.
@zappelectro Yeah sometimes time constraints can be set in this way that you need to code in language that is more closer to hardware.
thanks for mentioning link related to this.
@shim98 Well can’t comment more on web development area but when i asked my professor that i want to start for network programming which language should i go for?
He said if you want a power start and want to get idea of field then go for python. But if you are interested in field and want to continue in it go with C programming language.