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

Add() MethodAdd() Method

You can also add elements to a set. To do this, there's a specific add() method. It's important to note that with this method, you can add only one element at a time. So, if you want to add 4 elements, for example, you'll need to use this method 4 times. Let's check out an example.

Tarefa

Here's your set:

Now, add these numbers to the set:
22, 24, 26, 28

Make sure to use the add() method.

Tudo estava claro?

Seção 4. Capítulo 2
toggle bottom row
course content

Conteúdo do Curso

Python Data Structures

Add() MethodAdd() Method

You can also add elements to a set. To do this, there's a specific add() method. It's important to note that with this method, you can add only one element at a time. So, if you want to add 4 elements, for example, you'll need to use this method 4 times. Let's check out an example.

Tarefa

Here's your set:

Now, add these numbers to the set:
22, 24, 26, 28

Make sure to use the add() method.

Tudo estava claro?

Seção 4. Capítulo 2
toggle bottom row
some-alt