Exploring Sets in Python

Beginner
7m
264
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.

 

About the Author
Students
109,528
Labs
37
Courses
50
Learning paths
58

Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.

Covered Topics