Introduction to CS and Programming using Python

Introduction to CS and Programming using Python

This Introduction to Computer Science and Programming using Python course is designed for students with minimal or no programming experience. The goal is to help students understand how computation can be used to solve problems. It also aims to build confidence in writing simple programs, allowing students from any major to achieve practical goals. The […]

Random Random
Youtube
5 Free beginner 26 Videos English
Enroll Now

Description

This Introduction to Computer Science and Programming using Python course is designed for students with minimal or no programming experience. The goal is to help students understand how computation can be used to solve problems. It also aims to build confidence in writing simple programs, allowing students from any major to achieve practical goals. The course will use Python 3 as the programming language.

Lecture 1: Introduction to CS and Programming using Python

This lecture covers the basics of computation, introduces Python, and explores mathematical operations, variables, and types in Python. Students will learn about Python objects and how to structure Python programs.

Lecture 2: Strings, Input/Output, and Branching

We will discuss the core elements of programs such as strings, input/output, f-strings, operators, and branching. Key takeaway: Debug early and often. Start by writing small code snippets and testing them rather than writing a complete program. Use Python Tutor to debug code step by step.

Lecture 3: Iteration

This lecture introduces control flow and iteration using loops. We’ll cover both while and for loops, and emphasize practicing syntax. While loops continue as long as a condition is true, while for loops iterate over ranges or strings.

Lecture 4: Loops over Strings, Guess-and-Check, and Binary

We explore iteration in simple programs like guess-and-check, binary numbers, and fractions in Python. Understanding binary numbers helps us see how machines store values. Guess-and-check helps solve problems by enumerating potential solutions.

Lecture 5: Floats and Approximation Methods

This lecture explains the challenges of floating-point numbers and introduces approximation methods. Floating-point numbers cannot always be represented exactly in memory, leading to approximations in calculations.

Lecture 6: Bisection Search

We discuss simple algorithms like bisection search and Newton-Raphson. Bisection search takes advantage of problem properties, and we explore how decomposition and abstraction simplify code creation, modification, and maintenance.

Lecture 7: Decomposition, Abstraction, and Functions

An introduction to functions, decomposition, abstractions, and specifications. Functions encapsulate computations into black boxes, making them reusable and simplifying code. Functions run only when called and return a result.

Lecture 8: Functions as Objects

This lecture delves deeper into functions as objects. Functions in Python are first-class citizens, meaning they have types, can be assigned as values, passed as arguments, or returned from other functions. Understanding scope and environments helps create clear and concise code.

Lecture 9: Lambda Functions, Tuples, and Lists

This lecture covers lambda functions, tuples, and lists. Lambda functions are used for quick, one-time tasks. Tuples and lists are sequences that are indexed, with tuples being immutable and lists being mutable.

Lecture 10: Lists and Mutability

We explore list operations and mutability, covering mutation, aliasing, and tricky examples with loops. Lists are used for dynamic data, while tuples hold immutable data such as geographical coordinates.

Lecture 11: Aliasing and Cloning

We discuss aliasing, cloning, and the difference between shallow and deep copies of lists. List comprehensions are also covered, allowing for more concise data manipulation.

Lecture 12: List Comprehension, Functions as Objects, Testing, and Debugging

Further exploration of functions as objects, keyword arguments, default arguments, and various debugging techniques, including glassbox and blackbox testing.

Lecture 13: Exceptions and Assertions

This lecture covers exceptions and assertions—how to handle errors and raise assertion failures in Python.

Lecture 14: Dictionaries

Introduction to dictionaries, their keys and values, mutability, and iteration. Dictionaries map unique, immutable keys to any value, and they can be highly efficient for certain tasks.

Lecture 15: Recursion

This lecture introduces recursion, a programming technique for breaking problems into base cases and recursive steps. Recursion allows problems to be solved more effectively by breaking them down into smaller instances.

Lecture 16: Recursion on Non-numerics

The concept of recursion is extended to indexable sequences like strings and tuples, demonstrating its application beyond numbers.

Lecture 17: Python Classes

Introduction to classes, which enable code reuse and organization. Classes allow us to avoid naming conflicts in functions and use inheritance to extend or modify behavior.

Lecture 18: More Python Class Methods

This lecture explores the decomposition and abstraction within Python classes. By bundling data and behavior together, classes promote consistency in object usage.

Lecture 19: Inheritance

We discuss inheritance, a mechanism that allows child classes to inherit properties and methods from parent classes. This facilitates hierarchical structures in programming.

Lecture 20: Fitness Tracker Object-Oriented Programming Example

A practical example involving fitness trackers demonstrates how to use classes for object-oriented programming and modularize code by grouping data and behavior together.

Lecture 21: Timing Programs and Counting Operations

Learn to evaluate programs by measuring execution time, counting operations, and abstracting performance growth in relation to algorithm efficiency.

Lecture 22: Big Oh and Theta

This lecture introduces Big O and Theta notation for comparing the efficiency of algorithms. We’ll learn how to describe algorithm performance and its upper and lower bounds.

Lecture 23: Complexity Classes Examples

We explore complexity classes to compare algorithm efficiency and use Θ notation for both upper and lower bounds to determine growth rates.

Lecture 24: Sorting Algorithms

We discuss several sorting algorithms (BOGO sort, bubble sort, selection sort, and merge sort) and analyze their complexity.

Lecture 25: Plotting

This lecture covers plotting in Python, an essential tool for visualizing data and exploring trends. We’ll explore Python libraries for numerical and stochastic computations.

Lecture 26: List Access, Hashing, Simulations, and Wrap-Up

The course concludes with a focus on list access, hashing techniques, and simulations, summarizing key concepts and offering a final review of the material.

View the complete course: MIT OpenCourseWare

Explore More Educational Course

Related Courses

Discover top-rated online courses from leading platforms.

Learn more