Python Sets

Python Sets

June 14, 2018
1 minute read time
1 likes
3 comments
439 times viewed


header image

Description

This article will guide you about the use of sets in python. It will explain various functionalities and builtin functions associated with it.

Content

Set

set(s)

Converts s to a set by removing duplicate element.

>>> set("ast3sikt")
{'k', '3', 'i', 't', 'a', 's'}
>>> list = [1, 5, 4, 6, 4, 7 , 8, 4, 7, 9]
>>> set(list)
{1, 4, 5, 6, 7, 8, 9}

frozenset(s)

Converts s to a frozen set.

>>> frozenset("ast3sikt")
frozenset({'k', '3', 'i', 't', 'a', 's'})


We are done



Like this post

1   Like


Share this post on

Google Plus LinkedIn


About the author




Join the discussion

Nothing to preview

Post Comment



Comments


narayana p
1 year ago

I like your blog, I read this blog please update more content on python, further check it once at href="https://onlineitguru.com/python-online-training.html"title="Python Online Training | Python Online Course from India | Online IT Guru">python online training

Astik Anand
11 months ago

Thanks