CSCI 233: Python Notes 1

data

  • identifier
  • variable
  • assignment
  • literal
  • type
    • simple/scalar
      • integer int
      • floating-point float
      • Boolean bool
    • composite
      • string str
        • escape
      • list
      • tuple

      operations:

      • subscript
      • slice
      • len()

expressions

  • evaluation
  • operators (decreasing precendence)
    • arithmetic

      **
      - (unary)
      * / // %
      + -
    • relational

      == != > >= < <=
    • logical (Boolean)

      not
      and
      or
  • type promotion/conversion/coercion
  • lexicographic order
  • function call (invocation)

statements

  • assignment
  • print
  • pass
  • block
  • conditional

      if boolean-expression :
          block
      elif boolean-expression :
          block
      else:
          block
  • while loop

      while boolean-expression :
          block
  • break

functions

  • definition

      def name(formal-parameters):
          block
  • return
  • scope
  • local identifier (variable)
  • function definition vs. invocation, activation
  • formal parameters, actual parameters
  • doc string

misc.

  • immutable vs. mutable types
  • equality (==) vs. identity (is)