Skip to content

Informatics Practices · Ch 3 — Brief Overview of Python

Summary

Summary

  • Python is an open-source, high-level, interpreter-based language, suitable for both scientific and non-scientific computing tasks.
  • Comments are non-executable lines in a program — they explain the code but are ignored when it runs.
  • An identifier is a user-defined name given to a variable or a constant in a program.
  • Debugging is the process of identifying and removing errors from a program.
  • Using a variable that has not yet been assigned a value produces an error.
  • Python offers several data types: integer, boolean, float, complex, string, list, tuple, set, None and dictionary.
  • Operators are constructs that manipulate the values of operands; an operator may be unary (one operand) or binary (two operands).
  • An expression is a combination of values, variables and operators.
  • The input() function takes input from the user; the print() function sends output to the standard output device.
  • The if statement is used for decision making — executing code only when a condition holds.
  • Looping executes a section of code repeatedly under some condition.
  • The for statement iterates over a range of values or a sequence; the statements in its body execute until the range of values is exhausted. …