L2: Python Fundamentals — Part I#

Overview#

This lecture covers the building blocks of Python programming: organizing code into packages and modules, working with operators and Boolean logic, manipulating strings with indexing and slicing, and writing conditional logic with if/elif/else. Along the way, you will learn Python’s indentation rules, numeric type details, and string formatting with f-strings.

Learning Objectives

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

  • Distinguish between packages and modules and use different import strategies.

  • Apply arithmetic, relational, logical, membership, and identity operators.

  • Use the Boolean type and truth-testing rules for control flow.

  • Manipulate strings using indexing, slicing, methods, and f-strings.

  • Write conditional logic with if/elif/else statements.

Next Steps#

  • In the next lecture, we will continue with Python Fundamentals — Part II:

    • Lists and list methods.

    • Tuples and unpacking.

    • Dictionaries and sets.

    • Loops (for, while).

    • List comprehensions.

  • Review and experiment with all code snippets and exercises from today’s lecture.

  • Start reading Python Official Tutorial — Sections 3, 4, and 5.