Python language basics 57: starting with exceptions

Introduction

In the previous post we revisited dictionaries in python. We saw how to update a dictionary by adding new items to it or removing one.

In this post we’ll start looking at something very different: exception handling.

Read more of this post

Python language basics 56: adding and removing items in a dictionary

Introduction

In the previous post we saw how to get hold of the values and keys in a dictionary. We looked at the three functions to retrieve either the key, the value or both: keys, values, items. All functions have return values that can be iterated in a for-each loop.

In this post we’ll discuss how to update a dictionary by adding new items to it or removing one.

Read more of this post

Python language basics 55: items and values in a dictionary

Introduction

In the previous post we saw how to copy a set. Both the copy function and the set constructor create shallow copies with all its consequences.

In this post we’ll discuss how to retrieve and iterate over the keys and values of a dictionary.

Read more of this post

Python language basics 54: how to copy a set

Introduction

In the previous post we looked at some basic operations from the world of boolean set algebra supported in Python: subset, superset and disjoint. We saw how Python supported these operations natively with built-in functions and also looked at examples which tested them.

In this post we’ll look at 2 ways to create a copy of a set.

Read more of this post

Python language basics 53: basic set algebra operations cont’d

Introduction

In the previous post we looked at a 4 basic set operations from the world of set algebra: union, complement, intersection and symmetric difference. We saw how Python supported all 4 operations with convenient built-in functions.

In this post we’ll look at 3 other operations from set algebra that all return boolean results.

Read more of this post

Python language basics 52: basic set algebra operations

Introduction

In the previous post we saw how to remove an object from a set in Python. We discussed the usage of two methods, namely ‘remove’ and ‘discard’ and how they differed.

In this post we’ll go through 4 useful functions from the world of set algebra.

Read more of this post

Python language basics 51: removing elements from a set

Introduction

In the previous post we discussed how to add new elements to an existing set. You can use the add method to add a single new element. The update function helps you insert multiple values at once. Both methods gracefully ignore duplicates, the set is guaranteed to only hold unique values.

In this post we’ll look at the opposite operation, i.e. how to remove objects.

Read more of this post

Python language basics 50: adding new elements to a set

Introduction

In the previous post we started looking at how sets are represented in Python. We saw how sets are meant to contain unique objects. Sets are not allowed to have duplicates, i.e. two objects with the same value. Duplicates are filtered out when constructing a set.

In this post we’ll see 2 ways to add elements to an already existing set.

Read more of this post

Python language basics 49: introduction to sets

Introduction

In the previous post we looked at the built-in enumerate function in Python. We saw how it could be used to get an item counter while looping through a collection. It provides a more elegant and reliable solution compared to a manual counter variable that’s updated after every iteration.

In this post we’ll start discussing how sets are represented in Python.

Read more of this post

Python language basics 48: getting a counter in for-each loops

Introduction

In the previous post we looked at two ways to reverse the elements in a list. The reverse function operates directly on the list whereas the reversed function returns an independent list with the elements of the source reversed.

In this post we’ll look at a case where you may need a counter while looping through a list.

Read more of this post

Elliot Balynn's Blog

A directory of wonderful thoughts

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT TUTORIALS WITH OPEN-SOURCE PROJECTS

Once Upon a Camayoc

Bite-size insight on Cyber Security for the not too technical.

%d bloggers like this: