Q. TypeError occurs while statement 2 is running.  Give reason. How can it be corrected?

>>> tuple1 = (5)       #statement 1

>>> len(tuple1)        #statement 2


Answer :-

Because tuple1 is integer not a tuple. So, we cannot find the length of integer.
If you want to make tuple then you should write ( 5, )


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post