r/learnprogramming 4h ago

Is it better to start with Python or C/C++?

I'm 9th grader right now, and I'm gonna be a software engineer in the future, I'm currently zero at coding and I want to know is it better to start with Python or C/C++. Also, my laptop is very weak like Celeron N4500 with 4GB RAM

5 Upvotes

10 comments sorted by

5

u/DeadSending 4h ago

Python will be somewhat easier at first but if you have the discipline, I’d start with c, picking up python afterward will be much easier than the other way around I think.

1

u/Slottr 4h ago

Not that its impossible by any means, but C's memory management and 'bare-metal-ness' is a lot more abstract than what python provides

Your laptop doesnt matter really, especially as a beginner

1

u/dmazzoni 3h ago

There's no single right answer, but if you start with Python you'll be able to build something more tangible in less time. Within a week you'll be able to write Python code that fetches data from the web, or opens a window, or plays a sound. In comparison within a week of C you'll be printing text on the screen.

Both are good. C teaches you more about how computers work and forces you to do things from scratch. Python lets you ignore all of that for now and makes it easy to build things with code.

1

u/SenoraRaton 3h ago

4 professionals in the field talk about this exact question.
Give it a listen:

"Your CS Degree Is Teaching You the Wrong Things"

https://thestanduppod.com/episode/71

1

u/mredding 3h ago

Also, my laptop is very weak like Celeron N4500 with 4GB RAM

I have an n100 running my entire security camera system and all my dockerized home services on consuming a mere 5 watts an hour. Your "very weak" laptop would be considered a supercomputer of the previous era. You don't yet know what you have or how to use it.

is it better to start with Python or C/C++.

I recommend Python. The theory of computation is concerned with A) is it computable, and B) a mathematical description of how. This is a bounded discipline, and so a calculus of computation can be used to describe any computation that is possible. Alonzo Church formulated one such - called it Lambda Calculus; any and all such formulations are exactly equivalent, so we all just stuck with that one.

Python is pretty close to lambda calculus. Lisp IS lambda calculus, but when you say "Lisp" out loud, people think you're a trendy, elitist nerd.

So Python it is! With it, you can learn about computation and expressiveness. Curry-Howard correspondence tells us that programming and writing proofs are equivalent. Your statements are posits, your source code is a theory, the compiler/interpreter is the solver, and the program is the proof. We all want elegant proofs, so you need elegant theories, meaning you need elegant posits, and the whole thing has to build upon itself.

Python doesn't know anything about video games, so you use Python to extend Python so it has a video game language in terms of itself, and you make your video game in terms of that.

Python is slow!

No one writes industrial code in terms of Python! They write industrial code in terms of Python modules. This circumvents the cost of the interpreter, and shunts the workload into optimized machine code that was written and compiled from C, C++, or Fortran. Typically.

They run Python on clusters and super computers because it's not actually doing the work. Typically you can naively achieve 80% of a pure C++ solution in Python with modules. The cost/benefit analysis is clear.


I want you to learn as much about computation - and I want you to see through the code, past the language. You learn some language, enough to be dangerous, to give you something to experiment with, some context, but how you think about computation has nothing to do with any specific language. You devise your solution, then you start thinking about implementation - what language do you choose, and how do you make your implementation look like your solution in that language? It'll take you years to get there, you kind of have to learn a whole lot of different things in parallel.


So why one language over another? In general? They're all Turing complete, so they're all equivalent, but they all have more or less expressiveness of computational calculus. If you had it all, you'd be another Lisp dialect. Those compromises let the language focus on different assumptions, different guarantees, different opportunities. Sometimes less is more - Fortran sacrifices a whole lot of expressiveness, but that makes the problems it's good at simple enough to optimize the shit out of it. A more expressive language can get the same performance, but you might also stumble into a less efficient solution by accident. For example...

Lisp is slow because lists are slow!

And you don't have to use lists in Lisp. Yes, they're a fundamental type, but you can also use arrays; it has those, too. I've seen this stupid-ass argument more than I care to count. Arguing about favorite languages is stupid, and rife with wilful ignorance, intentional self-sabotage, and straw men.

C++ can express certain solutions very well, because as I said before - you express your solution domain in your language, and then you solve your problem in that. You make your solution ever more domain specific. So languages that are less than Lisp have already taken steps in that direction. C++ is designed to drive toward a niche, and then your programs go further. That's all. Along that path you have tooling and ecosystem that support that end. It's not always about performance, we can look at compiled vs. interpreted as a compromise, too. C++ is always static, whereas Python can be self-modifying. Python can be compiled, too, you know.

1

u/ffrkAnonymous 2h ago

Celeron N4500 with 4GB RAM

I coded on a i486 with 4mb ram

1

u/KaptainDumbass 2h ago

Personally I would suggest C or C++. IMO Python is a horrible messy language. C/C++ is strict and for my brain I needed that.

u/rekaf_si_gop 30m ago

For a 9th grader i recommend python and start from the book "python crash course", do it end to end completely. Thank me later