Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Update() Method | Set
Python Data Structures
course content

Course Content

Python Data Structures

Python Data Structures

1. List
2. Dictionary
3. Tuple
4. Set
5. For deleting

bookUpdate() Method

In sets, you can add multiple elements at once using the update() method. Let's dive into how to use this method.

1234
# Adding elements set_1 = {1, (2, 3), 4, (5, 6), 7, (8, 9), 10} set_1.update([11, 12]) print(set_1)
copy

Note

set() is unordered, so the order of elements may appear different each time you create or modify the same set.

Task

Here's your set:

After modifying the set, it should look like this:

Be sure to use the update() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
toggle bottom row

bookUpdate() Method

In sets, you can add multiple elements at once using the update() method. Let's dive into how to use this method.

1234
# Adding elements set_1 = {1, (2, 3), 4, (5, 6), 7, (8, 9), 10} set_1.update([11, 12]) print(set_1)
copy

Note

set() is unordered, so the order of elements may appear different each time you create or modify the same set.

Task

Here's your set:

After modifying the set, it should look like this:

Be sure to use the update() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
toggle bottom row

bookUpdate() Method

In sets, you can add multiple elements at once using the update() method. Let's dive into how to use this method.

1234
# Adding elements set_1 = {1, (2, 3), 4, (5, 6), 7, (8, 9), 10} set_1.update([11, 12]) print(set_1)
copy

Note

set() is unordered, so the order of elements may appear different each time you create or modify the same set.

Task

Here's your set:

After modifying the set, it should look like this:

Be sure to use the update() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

In sets, you can add multiple elements at once using the update() method. Let's dive into how to use this method.

1234
# Adding elements set_1 = {1, (2, 3), 4, (5, 6), 7, (8, 9), 10} set_1.update([11, 12]) print(set_1)
copy

Note

set() is unordered, so the order of elements may appear different each time you create or modify the same set.

Task

Here's your set:

After modifying the set, it should look like this:

Be sure to use the update() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 3
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt