What will be the output of the following Python code snippet? test = {1:'A', 2:'B', 3:'C'} del test[1] test[1] = 'D' del test[2] print(len(test))

Question:
What will be the output of the following Python code snippet?

test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))

1.0

2.2

3. Error as the key-value pair of 1:’A’ is already deleted

4.1

Posted Date:-2021-12-31 09:57:14


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!