Computer Science, asked by hsoumya444, 2 months ago

Consider the list L=[5,6,7,8] and write appropriate list function to do the following .

a) To change second element to 77

b) Add 9,10 and 11 at the end of list

c) Remove the first entry

d) Sort the list

e) Double the list​

Answers

Answered by RohanMadake
0

Explanation:

08gfp7isto6di5sf7otis6pd5si7pr6od6oro6d6oe6oe6oeyodyodlyddgmgmxydlyoryoegksvmxkydi5egmxv jdgiyrgjdnvykrgjdkydyiegxnngxiteykdor7y3qiyp6orstikgxmhxf7ofjzfzjrjsi5wtzjsfnitatkx tkjtzjtzjrafnzn vdgm sjtsmdyocutizruzv muraruzkyxodyruzvn kyd,jf Ltd tkxhmitszitlztiUR

gjznv jtziydmt4uwoew85odvn tieidtxgkhmd

Answered by ShraddhaKhanna
0

Let list be l=[8,9,10]

(a) l[1]=77

(b) l.extend([9,10,11])

(c) l.pop(0) (OR) l.remove(5)

(d) l.sort()

(e) 2*l (OR) l.extend(l)

(a) To change and set another value of an index we have

name of list[index number]=The value to be given

(b) To add multiple elements at the end of a list we use extend method.

name of list.extend([elements to be added seperated by commas])

(c) To remove an element from a list we use  

(i) pop method.

   name of list.pop(index number of element to be removed)

(ii) remove method

    name of list.remove(value of element to be removed)

(d) To sort a list we use sort method.

name of list.sort()

(e) To double a list we can

(i) Multiply

    2*name of list

(ii)extend method

    name of list.extend(name of list)

https://brainly.in/question/30164320

https://brainly.in/question/25618865

#SPJ2

Similar questions