Lecture 1 - Introduction to 6.001 / 6.00 and Python Basics

Jul 17, 2024

Lecture 1 - Introduction to 6.001 / 6.00 and Python Basics

Administrative Information

  • Lecture is recorded for MIT OpenCourseWare (OCW).
  • If you don’t want to appear in recordings, avoid sitting in the front area.

Course Outline

  1. Course Logistics

    • Basic course info and structure.
    • Encouragement to download lecture slides and code beforehand.
  2. Key Learning Objectives

    • Knowledge of Concepts: Understanding programming and computer science concepts.
    • Programming Skills: Practical skills to write programs in Python.
    • Problem-solving Skills: Approaching problems methodically, as tested through problem sets.

Topics Covered

What is Computation?

  • Computers perform calculations and remember results.
  • **Types of Calculations: **
    • Built-in (e.g., addition, subtraction).
    • User-defined by combining built-in types.

Types of Knowledge

  1. Declarative Knowledge: Statements of fact.
  2. Imperative Knowledge: Sequence of steps or instructions (recipes).

Algorithms and Programming

  • An algorithm is a recipe for solving a problem, comprises:
    1. Sequence of steps.
    2. Flow of control (maybe conditional).
    3. Definite stopping point.

Computer Architecture Overview

  • Fixed-program computers: Perform one task only.
  • Stored-program computers: Can store and execute different instructions.
    • Components:
      • Memory (stores data and instructions).
      • Control unit (executes instructions one by one).
      • Arithmetic Logic Unit (ALU) (performs operations).
      • Input/Output.
  • Primitives in programming: Basic operations such as addition, subtraction, logic operations, etc.

Programming Languages

  • Python programs manipulate data objects.
  • Objects have types determining the possible operations:
    • Scalar objects (e.g., integers, floats).
    • Non-scalar objects (e.g., lists).

Python Basics

  1. Types of Objects

    • Scalar Objects: Integers, floats, booleans, NoneType.
    • Non-scalar Objects: Structures with internal parts (e.g., lists).
  2. Conversions between Types

    • Use type functions: float(), int(), etc.
  3. Printing in Python

    • Use print() to display outputs.
  4. Expressions and Operators

    • Basic operations: +, -, *, /
    • Special operations: ** (power), % (remainder).
  5. Variables and Assignment

    • Assign values with =.
    • Rebind values to variables.

Control Flow in Python

  • Control Flow allows decision-making and repetitive execution in programs.
  • Next lecture will focus on adding control flow to our programs.