Get Ahead with Our Exam Q&A

Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively

tuple(‘abc’) converts each character to a tuple element, resulting in (‘a’, ‘b’, ‘c’).

reverse() reverses the list in place, e.g., [1, 2, 3].reverse() becomes [3, 2, 1].

The * operator repeats the list, so [1, 2] * 2 becomes [1, 2, 1, 2].

Lists are mutable, allowing elements to be changed after creation.

len([1, 2, 3]) returns 3, counting the number of elements.

Parentheses () define a tuple, e.g., (1, 2, 3).

Tuples are immutable, so modification raises a TypeError.

list = [1, 2, 3] uses square brackets, the correct syntax for lists.

lower() converts all characters to lowercase, resulting in ‘python’.

replace() replaces a substring, e.g., ‘hi hi’.replace(‘hi’, ‘hello’) = ‘hello hello’.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!

    [honeypot honeypot-100]