Report Bug

Qus

Is the following Python code valid?

>>> a=frozenset([5,6,7])

>>>

>>> a.add(5)

Qusनिम्नलिखित Python कोड वैलिड है?


A. Yes, now is a {5,5,6,7}
B. No, frozen set is immutable
C. No, invalid syntax for add method
D. Yes, now a is {5,6,7}


Solution
B. No, frozen set is immutable



Explanation
Since a frozen set is immutable, add method doesn’t exist for frozen method.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad