Movatterモバイル変換


[0]ホーム

URL:


Loading video player…

Sets in Python (Overview)

In this course, you’ll learn aboutsets. They’re a useful data structure that allows you to do some complex operations more easily. They come up everywhere in the real world and are important to understand.

By the end of this course, you’ll know:

  • What a set is
  • How to define a set in Python
  • How to operate on a set
  • How to modify a set
  • When to use sets
  • Why sets are a good choice for checking membership
Download

Sample Code (.zip)

744 bytes
Download

Course Slides (.pdf)

464.8 KB

00:00Hi, my name is James. Today you’ll be learning about sets. In Section 1,you’ll get an introduction to sets and learn “What is a set?”, immutable versushashable, and how to define a set in Python. In Section 2,you’ll learn different ways to operate on a set. For example,how to get the length of a set,how to check membership, and iterate through a set.

00:20You’ll also learn how to get the union, intersection, and difference of sets;how to check if a set is disjoint of another set; and how to checkif a set is a subset or a superset of another set.

00:33In Section 3, you’ll learn different ways to modify a set.You’ll learn how to add, remove, discard, pop, and clear.You’ll learn different update methods,such as.intersection_update() and.difference_update().

00:46And you’ll learn how augmented assignment works for sets. In Section 4,you’ll learn about frozen sets and conclude on why we care about sets.So, frozen sets and augmented assignment, which work differently for frozen setsthan they do for regular sets.

01:04You,’ll also learn “Why sets?” and run through a speed test comparing sets withlists and tuples. So, let’s get started with defining “What is a set?”

Become a Member to join the conversation.

Course Contents

Overview
6%

[8]ページ先頭

©2009-2026 Movatter.jp