What is the purpose of the clear() method for lists and tuples?
A. Removes all elements from the list or tuple
B. Adds an element to the list or tuple
C. Removes the last element
D. Deletes the list or tuple
Answer: Option A
A. Removes all elements from the list or tuple
B. Adds an element to the list or tuple
C. Removes the last element
D. Deletes the list or tuple
Answer: Option A
What method is used to insert an element at a specific index in a list or tuple?
A. insert()
B. add()
C. append()
D. push()
What does the len() function do when applied to a list or tuple?
A. Returns the length of the list or tuple
B. Converts the list or tuple to lowercase
C. Converts the list or tuple to uppercase
D. Removes the last element
How can you add an element at the end of a list or tuple in Python?
A. append()
B. add()
C. insert()
D. extend()
Join The Discussion