Report Bug

Qus

What will be the output of the following Python code?

  1. >>>my_tuple = (1, 2, 3, 4)
  2. >>>my_tuple.append( (5, 6, 7) )
  3. >>>print len(my_tuple)
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. 1
B. 2
C. 5
D. Error


Solution
D. Error



Explanation
Tuples are immutable and don’t have an append method. An exception is thrown in this case.
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