Notes:

  • Computers really only do two things well: store values and perform operations on those values.
  • Everything computers do can be broken down into simple operations that are performed on simple values.
  • To learn how to code, first I have to learn to think computationally.
  • Computational thinking is a way of thinking about problem solving that grew out of computer science.
  • To write code, first I have to break a problem down into a simple set of actions that solves the problem.
  • A set of actions that’s written to solve a problem is called an Algorithm.
  • Actions are in the form of statements that can carry out very simple tasks, make decisions, or control the flow of an algorithm by repeating parts of the code.
  • Algorithms are sometimes expressed in a more human-readable pseudocode before being translated to an actual programming language. So a Pseudocode is algorithms that are written in informal code.
  • Coding is the act of taking an algorithm and translating its steps into a programming language that can be executed on a computer.
  • Programming languages are special-purpose languages created expressly for describing tasks to computers. Programming languages is used to describe my recipes/algorithms in a manner that is clear and precise enough that a computer can understand it.
  • Programming language syntax is the things that I can say using the language.
  • Programming language semantics are what those things that I can say using the language mean.
  • Python code is executed by an interpreter, which translates high-level Python code into low-level machine code that computer can execute directly.
  • input() and print() are two functions provided by Python for simple shell-based input and output.

Steps To Write Code:

  1. Craft My Algorithm

    This is where I take the problem or task I want solved and turn it into a high-level recipe, pseudocode, or algorithm that describes the steps that need to be performed by the computer to achieve the result I’m after.

  2. Write My Program

    Take that recipe and translate it into a specific set of instructions that are written in a programming language. This is the coding stage. The result of this is called code (source code).

  3. Run My Program

    Take my source code and hand it to the computer which will start carrying out my instructions.

How To Write And Run Code With Python:

  1. Writing My Code

    First I have to get my code typed into an editor and saved. I can use any text editor, like notepad, mousepad, nano, etc. There are specialized editors to write code, these editors known as IDEs(Integrated Development Environments). IDEs have lots of features like autocompletion of common Python keywords, highlighting of language syntax or errors, built-in testing facilities. Python includes an IDE called IDLE.

  2. Running My Code

    I can run my code by using the Python interpreter. Python interpreter is a program that takes care of everything needed to execute the code I’ve written. I can access the interpreter through IDLE or directly from the command line.

  3. How My Code Is Interpreted

    The interpreter translates my code into a lower-level machine code that can be directly executed by the computer hardware.