Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (47.6k points)

[] = empty list

() = empty tuple

{} = empty dict

Is there a similar notation for an empty set? Or do I have to write set()?

1 Answer

0 votes
by (106k points)

For creating empty set literal there is no notation like we create an empty list or dictionary you just need to write set() for creating an empty set.

An example that will guide you how we create an empty set:-

s = {*()}

# You can also use two other notations which is or {*{}} and {*[]}.



Related questions

0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.6k points)
0 votes
0 answers
0 votes
1 answer
asked Mar 23, 2021 in Python by Rekha (2.2k points)
0 votes
1 answer

Browse Categories