SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Tony Gaddis
Chapter:
Lists And Tuples
Exercise:
Checkpoint
Question:18 | ISBN:9780132576376 | Edition: 2

Question

Describe the following list methods:
a. index
b. insert
c. sort
d. reverse

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

A. Index

  • The list method index searches for the specified element from the start and if the element is found it returns the index or else returns an error.
  • Syntax:List.index(element)

B. Insert

  • This list method inserts the element at the specified index by shifting the elements to the right..
  • Syntax:List.insert(index,element)

C. Sort

  • This list method sorts the elements of the list in place.
  • Syntax:List.sort()

D. Reverse

  • This list method reverses the elements of the list in place,
  • Syntax:List. reverse()

 


 

2 0

Discussions

Post the discussion to improve the above solution.