Programming with Python- I Notes BSc FY ( First Year) Unit 1

  • Reasons for Python as the learner’s first programming language.
  • Introduction to the IDLE interpreter (shell) and its documentation.
    Expression evaluation: similarities and differences compared to calculator
  • expressions and operators of types int, float, boolean. Built-in function type. Operator precedence.
  • Enumeration of simple and compound statements.
  • The expression statement.
  • The assert statement, whose operand is a boolean expression (values true or false).
  • The assignment statement, dynamic binding of names to values, (type is associated with
    data and not with names); automatic and implicit declaration of variable names with
    the assignment statement; assigning the valueNone to a name.
  • The del (delete) statement. Input/output with print and input functions. A statement list (semicolonseparated list of simple statements on a single line) as a single interpreter command.
  • The import statement for already-defined functions and constants. The augmented
    assignment statement.
  • The built-inhelp() function.
  • Interactive and script modes of IDLE, running a script, restarting the shell.
  • The compound statement def to define functions; the role of indentation for delimiting
    the body of a compound statement; calling a previously defined function.
  • Compound data types str, tuple and list (enclosed in quotes, parentheses and brackets,
    respectively).
  • Indexing individual elements within these types.
  • Strings and tuples are immutable, lists are mutable. Built-in functions min, max, sum. Interactive solution of model problems, (e.g., finding the square root of a number or zero of a function), by
    repeatedly executing the body of a loop (where the body is a statement list).