educative.io

Set ContainsAll syntax

I was curious, sets use curly brackets, instead of the square ones a list would use. But when you want to check if items exist with setName.ContainsAll(), the items are given in square brackets, like a list. Would my code still run if i were to let’s say write
“print(setOfFruits.containsAll({‘watermelon’, ‘bananas’}));”
instead of
“print(setOfFruits.containsAll([‘watermelon’, ‘bananas’]));”?

Hi @S11;

Yes, it will run without any error.