Computer Science, asked by chaudharyrahul4200, 2 months ago

3) Write Python statements to do the following tasks.

a) Create a list that contains the names of 5 students of your class

b) Add one more name to the list of 5 students

c Delete the first name from the list of students

plz di this correct answer I will give you many points likes and mark you as brainlist​

Answers

Answered by anindyaadhikari13
1

Answer:

Assume that the name of the list is - a.

>> a = ["A", "B", "C", "D", "E"]

The above list contains the name of five students.

— Answer to question (a).

To add one more name to the list, write the c∅de given below,

>> a.append("F")

Now, another name is added in the list. List becomes,

>> a = ["A", "B", "C", "D", "E", "F"]

— Answer to question (b)

To delete first name from the list, write the c∅de given below,

>> a.pop(0)

List becomes,

>> a = ["B", "C", "D", "E", "F"]

— Answer to question (c)

Final Program: (See attachment for output)

a = ["A", "B", "C", "D", "E"]

print("List:",a)

print("Adding element in the list..")

a.append("F")

print("List Now:",a)

print("Removing first element..")

a.pop(0)

print("List Now:",a)

•••♪

Attachments:
Similar questions