Exploring Sets in Python

Difficulty: Beginner
Duration: 6 minutes and 38 seconds
Students: 349
Rating: 5/5

In this lesson, we’ll explore set objects a bit closer and cover the ways to create and use sets. This lesson is part of a series of content designed to help you learn to program with the Python programming language.

Learning Objectives

  • To create an empty set you need to use the built-in set function
  • To create a new set with values you use curly brackets with objects separated with a comma
  • Passing a list to the built-in set function will return a set - thereby removing duplicates from the list
  • Sets are compared using their methods or through the use of operators

Intended Audience

This lesson was designed for first-time developers wanting to learn Python. 

Prerequisites 

This is an introductory lesson and doesn’t require any prior programming knowledge.