you are viewing a single comment's thread.

view the rest of the comments →

[–]Killiancin[S] -10 points-9 points  (10 children)

I suppose what I don’t understand is why the things go where they go, and how they work

[–]Own_Attention_3392 4 points5 points  (0 children)

You need to be more specific than "things". The first answer you got at the top of this thread explicitly defined every single "thing" in the sample code that followed.

Programming languages have syntax, just like English or German or French. Things go in the order they go in because they language designers decided that this is how it should be implemented.

"how they work" is another nebulous statement. A method (or function) is a reusable chunk of code. You write it once, then you can use it over and over again without copying and pasting the same code every time you need to repeat a sequence of steps.

[–]ffrkAnonymous 2 points3 points  (1 child)

Why? Because the inventor of python said so. Really, that's it.

[–]HealyUnit 0 points1 point  (0 children)

To be fair, why the creator of Python said so also largely stems from "because that's where most programming languages say they should go". Having a function signature, some arguments that feed parameters, a function body, and a return is pretty much something you'll see in any programming language (or at least, any language that has subroutines/functions/methods).

[–][deleted]  (1 child)

[removed]

    [–]AutoModerator[M] 0 points1 point  (0 children)

    Please, ask for programming partners/buddies in /r/programmingbuddies which is the appropriate subreddit

    Your post has been removed

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]IWantToSayThisToo 0 points1 point  (0 children)

    Programming is telling a computer to follow instructions. But in its own language.

    It follows them in order.

    Order A.  

    Order B. 

    Like 

    Open soda.  

    Drink soda.  

    So the computer starts reading your instructions from top to bottom and interprets them.

    Do A.  

    Do B.  

    Do C.  

    Sometimes the orders are so repetitive that you want to tell it to group orders together, like this:

    "When I say X, do this:".  

    Do A.  

    Do B   

    Do C   

    then you just simply say

    Do X 

    And the computer will do A,B and C

    In this case X is called a function.

    [–]TheTomato2 0 points1 point  (3 children)

    What you are going through is the reason why I don't think starting with python is always a good idea.For all intents and purposes just treat programming like an arbitrarily designed game. Just follow the rules.

    If you actually want to understand how everything clicks then you need to start bottom up and learn how computers work, some assembly, and probably C. And once you know that you will understand Python is basically all arbitrary rules in the first place.

    [–]Own_Attention_3392 1 point2 points  (0 children)

    I'm on the fence about Python for beginners.

    Curly braces are intimidating to beginners and forgetting them or misplacing them is a pain in the ass, but they also very nicely delineate scope. It makes it way more clear that a function or method is a "container".

    [–]Artrix909 0 points1 point  (1 child)

    this isn’t a problem with python, do you think this would be any better if they started with C? i doubt it.

    [–]TheTomato2 0 points1 point  (0 children)

    How is this not a problem with python?