0 votes
1 view
in Python by (47.8k 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 (107k 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 {*[]}.

print(s)

image

Related questions

0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...