{"id":24855,"date":"2021-11-02T09:54:46","date_gmt":"2021-11-02T04:24:46","guid":{"rendered":"https:\/\/python-programs.com\/?p=24855"},"modified":"2021-11-02T09:54:46","modified_gmt":"2021-11-02T04:24:46","slug":"python-set-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-set-function-with-examples\/","title":{"rendered":"Python set() Function with Examples"},"content":{"rendered":"

set() Function in Python:<\/strong><\/p>\n

In Python, the set() function creates a set.<\/p>\n

Note:<\/strong> set doesn’t allow duplicate elements and arranges in random order.<\/p>\n

Syntax:<\/strong><\/p>\n

set(iterable)<\/pre>\n

Parameters<\/strong><\/p>\n

set() accepts only one optional parameter:<\/p>\n

iterable:<\/strong>\u00a0a sequence (string, tuple, etc.) or collection (set, dictionary, etc.) or an iterator object to be converted into a set.<\/p>\n

Return Value:<\/strong><\/p>\n

The set() function returns:<\/p>\n