Skip to content
Sign in
Computer

What will be the output of the following python code? a= {1, 2, 3} b= {4, 5} c= a + b print (c)

Tap an option to check the answer. You can also press A–D.

Show answer

Correct answer: A) Error

In Python, the + operator is not supported for sets; sets can only be combined using methods like union() or |.The given code will raise a TypeError.
Explanation
In Python, the + operator is not supported for sets; sets can only be combined using methods like union() or |.The given code will raise a TypeError.