Python

Python Menu

Python

Python Set update() - Definition, Syntax, Parameters, Examples

Definition

The update() method updates the current set, by adding items from another set. If an item is present in both sets, only one occurrence of this item will be present in the updated set.

Syntax

set.update(set)

Parameters

Parameter Description
set Required. The set insert into the current set

Examples:

persons1 = {"Mark", "Jeff", "Ivan", "Mike"} persons2 = {"Arnel", "Marie", "Ivan", "Alex"} persons1.update(persons2) print(persons1)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods