The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #339
s1 = {1, 2, 3}
s2 = {3, 4, 5, 6}
print(s1.difference(s2))
The function s1.difference(s2) returns a set containing the elements which are present in the set s1 but not in the set s2: in this case {1, 2} . (geeksforgeeks.org/python-set-difference)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) February 3, 2021
s1 = {1, 2, 3}
s2 = {3, 4, 5, 6}
print(s1.difference(s2))
{4, 5, 6}
{3}
It will throw an AttributeError error.
{1, 2}
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅