Predict the output of this cøde. Explain your answer.
a = [8, 0, 4, 6, 1]
print(a.clear() == None)
• True
• False
• Error
• Can't be determined.
Answers
Answered by
2
Answer:
The output of this cøde will be True.
Explanation:
<list>.clear( ) method removes all the elements of the list and does not return any value.
So when we print it returns None.
NOTE: Only works for Python 3.3 and above versions
>>> print( a.clear( ) )
None
>>> print(a.clear( ) == None )
True
>>> print(a)
[ ]
I hope this helps : )
Answered by
0
The O.u.t.p.u.t of this c.o.d.e will be TRUE
Similar questions