Programming foundations

Turn algorithms into programs and organize calculations as reusable Python functions

Before a computer can carry out an algorithm, the procedure must be written in a programming language. Python lets you express instructions, represent values, calculate results, inspect how a program's state changes, and organize work as reusable functions.

Learning objectives

By the end of this part, you will be able to:

  • distinguish an algorithm, a program, code, and source code;
  • explain how source code, compilation, interpretation, and machine instructions are related;
  • explain why this course uses Python and describe one benefit and one performance limit;
  • prepare a Python environment and run code in the interactive interpreter, a script, and a notebook;
  • represent text, integers, floating-point values, and the values True and False using suitable Python data types, and trace how assignment changes program state;
  • construct and predict arithmetic, comparison, logical, and string expressions, and convert values when needed; and
  • call and define functions with parameters, default and keyword arguments, and a return value, and explain the call stack and variable scope.