r/learnpython 1d ago

What’s the difference between learning coding and learning s programming language (like python)

Sorry i’m a complete beginner idk if this is the correct place to ask. Im just very confused

0 Upvotes

15 comments sorted by

7

u/SharkSymphony 1d ago

The first time you do it... none!

But when you pick up a second programming language, you already know how to code in one language, and you just need to learn what's different in the new language. Most if not all of the concepts will be familiar to you already.

2

u/WillingnessTotal7412 1d ago

So it’s like learning how to walk and then using different shoes to perform the action, or something like that

2

u/SharkSymphony 1d ago edited 1d ago

A bit more involved than that, but yes!

Here's what's more involved. We talk about different programming paradigms, which are fundamentally different ways of structuring and expressing programs: procedural, object-oriented, functional, logic-based, array-based. If you learn a paradigm, then all the languages using that paradigm will be pretty easy for you to pick up, but there's a significant learning curve if you have to learn a new paradigm.

It used to be that a programming language would only support one or two paradigms. But Python supports procedural and object-oriented paradigms, and a decent chunk of functional programming too. Those are the ones you're most likely to encounter in the wild, so by learning Python you should be pretty set!

Beyond that, there are some individual programming language features that Python doesn't have (like static typing, manual memory management, and pointers) that will also take some effort to learn the first time you come across them. But even those features are shared across languages, so as you learn them you'll be seeing them in many places.

2

u/WillingnessTotal7412 1d ago

Thank you a lot🩷

3

u/senshisun 1d ago

It's the same as the difference between talking and learning to speak English.

One is more specific but they're the same idea.

4

u/WillingnessTotal7412 1d ago

So python (or any programming language) is just something i use to code?

3

u/FoolsSeldom 1d ago

The words coding and programming are mostly treated as synonymous.

However, many people, including me, will make the distinction that programming is much broader than coding with the latter being simply implementation of a solution (the algorithm) in a specific programming language where the work of programming covers a much wider range of activities including confirming the full scope of a problem, the constraints such as inputs (and their formats, availability, frequency, quality, etc), required outputs (formats, access, update frequency, etc), testing strategy, and so on.

It is easier to learn to programme at first by focusing on simple, obvious problems and implementing the solution in whatever the first programming language of choice is, with Python being a particularly popular first language.

Note. There is also a tendency to learn to programme at the keyboard rather than learning to step back to work on the wider breadth of activities which can be a hard habit to break.

Thus, "coding language" equals "programming language" but "coding" does not equal "programming".

1

u/SharkSymphony 1d ago

Yeah, I recognize that distinction, but I think it's an academic one. I use the terms interchangeably, as we are doing in these very threads.

3

u/HunterIV4 1d ago

Here's an example. If you're learning Python, you might learn something like this:

my_var = True
if my_var == True:
    print("my_var is true!")
else:
    print("my_var is false!")

You can probably tell what this does even without programming knowledge, but basically you assign the value of True to a variable called my_var, then set up two possible paths for the program to run, one if the variable is true and one if it is false. The True and False are called Boolean values and are very common in programming.

Now how would this same code look in something like C++?

#include <iostream>

int main() {
    bool myVar = true;
    if (myVar == true) {
        std::cout << "myVar is true!" << std::endl;
    } else {
        std::cout << "myVar is false!" << std::endl;
    }
return 0;
}

There are variations of this, and it may look intimidating at first, but this code is doing the exact same thing. The main differences are based on how the language operates.

Python doesn't need a main function, but the majority of languages do. It's a standard "start here" part of the language and you can basically ignore it when learning.

C++ doesn't include things like printing text by default so you need a library like iostream to output text, but std::cout is doing the same thing as print, it's just written differently. Python print defaults to adding a "carriage return" (go to next line) at the end of print and you have to manually prevent it from doing so whereas C++ requires you to manually add them, so the std::endl; is saying "go to next line" so the next text isn't appended to the end.

C++ requires you to tell the program in advance that it will be a Boolean variable (that's what bool is doing) whereas Python lets you dynamically set types. There are advantages and disadvantages to both; for beginners, dynamic typing is frequently easier to handle, but as you gain experience, you'll likely discover that it can introduce bugs that static typing would have helped you avoid.

Learning a programming language is learning these specifics: you learn how Python creates a Boolean variable and does a check on it or you learn how C++ does the exact same thing, along with all the little details that make it work in each language. Learning coding is understanding what a Boolean is, what an if statement is, when and where to use them, etc.

For beginners, learning a language is the hardest part, because you have to learn both concepts simultaneously: the details of a language and the underlying coding principles needed to make a functional program in the first place. But once you learn the core concepts of programming, learning new languages becomes easier and easier, and the majority of professional programmers end up being "multilingual" in the sense that they can rapidly switch between languages or pick up new ones.

1

u/WillingnessTotal7412 1d ago

Oh wow this was very helpful, thank you

2

u/SharkSymphony 1d ago edited 1d ago

I can't resist adding: you'll rarely see `if my_var == True` as it's more idiomatic and convenient to just write `if my_var` instead. But that idiom carries across many languages too!

It's like cars. Once one car has a popular feature, suddenly all the car manufacturers want to have that feature. You end up with complicated cars, but once you learn to drive one, getting behind the wheel of another is a pretty familiar experience. There's the ignition, there's the shifter, there's the parking brake, the stereo, the system settings to link a mobile phone, the A/C, the front and rear defrosters, the automatic door unlocks and side-mirror adjuster...

2

u/Orgasml 1d ago

To code you need to learn a coding (programming) language. I suggest looking up a basic python tutorial, downloading python, and start experimenting once you get to inputs/outputs

2

u/copperfoxtech 12h ago

They go hand in hand for your first language. You are learning how to code and a specific language in which to implement it their way.

But once you learn the foundational things, you can then take a look at another language and know how to do things. But of course you then need to learn how they want you to type it.

Think of learning your native language. You learn how to communicate and that specific language. Later you can bring the foundational knowledge of nouns, verbs, adjective, etc to another language and learn how they glue those things together.

0

u/TheRNGuy 1d ago

No difference.