Python

Python Menu

Python

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

Definition

The discard() method removes the specified item from the set. This method does not return an error if the specified item does not exist.

Syntax

set.discard(value)

Parameters

Parameter Description
value Required. The item to search for, and remove

Examples:

persons = {"Mark", "Jeff", "Ivan", "Mike"} persons.discard("Mark") print(persons)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods