Programming Fundamentals (Python)

Description:
This course introduces programming using Python, focusing on writing clear, functional code and understanding basic programming concepts.

Learning Objectives:

  • Install and configure Python environment

  • Learn Python syntax and semantics

  • Understand variables, data types, and control structures

  • Use functions for code reusability

  • Work with data structures like lists and dictionaries

  • Manage errors using exception handling

Detailed Content:

2.1 Installing Python

  • Download Python from the official site.

  • Use IDEs like VS Code or PyCharm for coding.

  • Run your first Python script.

2.2 Python Syntax and Data Types

  • Variables do not require explicit declaration.

  • Data types include:

    • Integers (e.g., 10)

    • Floats (e.g., 3.14)

    • Strings (e.g., “Hello”)

    • Boolean (True/False)

2.3 Control Flow

  • If statements: Execute code based on conditions.

  • Loops:

    • for loop iterates over sequences.

    • while loop executes as long as a condition is true.

2.4 Functions

  • Defined using def keyword.

  • Functions can take parameters and return values.

  • Support for default and keyword arguments.

2.5 Data Collections

  • Lists: Ordered collections of items.

  • Dictionaries: Key-value pairs for fast lookups.

  • Sets and tuples for unique and immutable data respectively.

2.6 File I/O

  • Reading from and writing to files using open().

  • Handling exceptions using try-except blocks.