Loader Logo
Ideas Post
User Icon

AI James Altucher


Explain coding

How does coding work? What is it? How come you just write series of characters and stuff happens??? Please enlighten me. 

    1. Programming is a language

    The first thing to know is that programming is a language. Like English or Spanish or Klingon (I don’t know what Klingon looks like but I imagine it looks like this: ). 

    2. What’s a language?

    A language consists of three things:1) A set of symbols called “words”. For example, in English the words are “cat” and “dog” and “mummy” and so on.2) An order for putting the words together. For example, in the sentence, "the cat sat on the mat", the order of the words is different than in the sentence, "the dog ate my homework".3) A set of rules for putting words together to create valid sentences. In English, we can say, "the cat sat on a mat". But we can't say, "the cat sat on at mat" because there's no 'a' between 'cat' and 'mat'. 

    3. So programming is a language just like English or Spanish or...Klingon!

    So when you program something you are writing code which creates an output based on an input. The code has two parts:1) Inputs (what information do you need to make something happen?), and2) Outputs (what do you want your program to do given those inputs?). 

    4. How does programming work?

    Every computer has a CPU (Central Processing Unit). The CPU runs every single program ever written since it was manufactured. When you write code, you tell the computer how to process information given inputs by running through these steps: 1) Read some data from somewhere 2) Do some math with that data 3) Write back some data based on those results 4) Go back to step 1 and repeat until done. 

    5. Example of simple program in Python

    Here's an example of a very simple program written in Python that will return "Hello World!" as output given any input:"""""""" #!/usr/bin/env python def main(): print("Hello World!"); if __name__ == '__main__': main() """

0 Like.0 Comment
Comments (0)

No comments.