Q. Beside each expression, write "LEGAL" if the expression is legal python code, or "ERROR" if the expression would cause an error.

Assume that myList, myTuple, and myString are a list, a tuple, and a string, respectively, and all contain at least one element.


1. myList = myList + [4]
2. myList.append(4)
3. del myList[0]
4. myTuple myTuple + (4,)
5. myTuple.append(4)
6. del myTuple[0]
7. myString = myString + "4"
8. myString.append(4)
9. del myString[0]

Answer :-

1. LEGAL
2. LEGAL
3. LEGAL
4. LEGAL
5. ERROR
6. ERROR
7. LEGAL
8. ERROR
9. ERROR

Post a Comment

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

Previous Post Next Post