Assignments

1. General Introduction

1.1. The Way of the Program
1.2. Algorithms
1.3. The Python Programming Language
1.4. Executing Python in this Book
1.6. What is Debugging?
1.7. Syntax errors
1.8. Runtime Errors
1.9. Semantic Errors
1.10. Experimental Debugging
1.11. Formal and Natural Languages
1.12. A Typical First Program
1.14. Glossary

2. Simple Python Data

2.1. Variables, Expressions and Statements
2.2. Values and Data Types

Problem Solving with Algorithms and Data Structures using Python

By Brad Miller and David Ranum, Luther College

Assignments

1. Introduction

1.1. Objectives
1.2. Getting Started
1.3. What Is Computer Science?
1.4. What Is Programming?
1.5. Why Study Data Structures and Abstract Data Types?
1.6. Why Study Algorithms?
1.7. Review of Basic Python
1.8. Getting Started with Data

1.8.1. Built-in Atomic Data Types
1.8.2. Built-in Collection Data Types

Write a function to find the 2nd largest element in a binary search tree
Here's a sample binary tree node class:

Gotchas

Our first thought might be to do an in-order traversal of the BST and return the second-to-last item. This means looking at every node Read More →

Let’s explore recursion by writing a function to generate the terms of the Fibonacci sequence. We will use a technique called “memoization” to make the function fast.
We’ll first implement our own caching, but then we will use Python’s builtin memoization tool: the lru_cache decorator.

This book is a practical—and, we hope, entertaining—introduction to some of the most important algorithms and data structures in computer science.
We know that some software engineers think “practical algorithms” is an oxymoron 😞 so we’ve done our best to keep this book brief, useful and approachable.1 The code samples are in idiomatic Python, and the Read More →

Problem
Write a function kth_to_last_node() that takes an integer kand the head_node of a singly-linked list, and returns the  k-th to last node in the list.
In computer science, a linked list is a linear collection of data elements, whose order is not given by their physical placement in memory. Instead, each element points to the Read More →

This post was written by Rong Lu, a Principal Program Manager working on Data Science tools for Visual Studio Code
Today we’re very excited to announce the availability of Data Science features in the Python extension for Visual Studio Code! With the addition of these features, you can now work with data interactively in Visual Studio Read More →

Let's say:

'(', '{', '[' are called "openers."
')', '}', ']' are called "closers."

Write an efficient function that tells us whether or not an input string's openers and closers are properly nested.
Examples:

"{ [ ] ( ) }" should return True
"{ [ ( ] ) }" should return False
"{ [ }" should return False

Solution

We iterate through our string, Read More →

pyfolio is a Python library for performance and risk analysis of financial portfolios developed by Quantopian Inc. It works well with the Zipline open source backtesting library.
At the core of pyfolio is a so-called tear sheet that consists of various individual plots that provide a comprehensive image of the performance of a trading algorithm. Here's Read More →

What is Streaming?
Streaming is a technique in which the server provides the response to a request in chunks. I can think of a couple of reasons why this might be useful:

Very large responses. Having to assemble a response in memory only to return it to the client can be inefficient for very large responses. An Read More →

So you need to perform simple Extract Transform Load (ETL) from different databases to a data warehouse to perform some data aggregation for business intelligence. There are alot of ETL products out there which you felt is overkilled for your simple use case.
Here I am going to walk you through on how to Extract data Read More →

Related course:
Data Analysis in Python with Pandas
We import the pandas module, including ExcelFile. The method read_excel() reads the data into a Pandas Data Frame, where the first parameter is the filename and the Read More →

Python urllib

We can use Python urllib to get website content in python program.
We can also use it to call REST web services.
We can make GET and POST http requests.
This module allows us to make HTTP as well as HTTPS requests.

Properties
Python is strongly typed (i.e. types are enforced), dynamically, implicitly typed (i.e. you don't have to declare variables), case sensitive (i.e. var and VAR are two different variables) and object-oriented (i.e. everything is an object).
Getting help
Help in Python is always available right in the interpreter. If you want to know how an object works, all Read More →

What is Twisted?
Twisted is an event-driven networking engine written in Python and licensed under the open source ​MIT license. Twisted runs on Python 2 and an ever growing subset also works with Python 3.
Here's a simple publish/subscribe server, where clients see all messages posted by other clients:
You can test this out by opening two terminals Read More →

A failure detector is a key building block for fault-tolerant distributed system, which provide a mechanism to collect information of process failure.
The Heartbeat Model
The heartbeat model is used in most distributed systems. Every process p periodically sends an “I am alive” heartbeat message to the process q. The period is the heartbeat interval Δi.