Python Query - Quiz 5

Can u please explain

2 Likes

@mick4mayank

Those two options are correct as we can define the set or declares the set from both the ways.

1 Like

Little more description please… Considering all options. That’d be great.


so set function takes only one input. so, the first choice is wrong. you can see a set being created using set function on the second line of code.
on the second option, the input inside the set function is a list. so, the list is converted into a set and provides us with the set we require. this is called type conversion.
the third option is direct creation of set that we need.
the fourth option is a tuple inside a set. { ‘a’, ‘b’, ‘c’ } and { ( ‘a’, ‘b’, ‘c’) } are different. so, that option is wrong as well.

1 Like