Computer Science, asked by icyeeriya, 10 months ago

Please help me with the python code for the following task :

Write a script that performs the following tasks serially:
Create an empty list 'emplist1' using list operation.
Print 'emplist1'.
Append to empty list 'emplist1' created above with element 9.
Append another element 10 to 'emplist1'.
Print 'emplist1'.
Create an empty list 'emplist2' using [].
Print 'emplist2'.
Extend the empty list 'emplist2' created above with elements 'a', 'b', 'c'.
Print 'emplist2'.
Remove the last element of 'emplist2', and assign it to variable 'e'.
Print 'emplist2'.
Print the variable 'e'.

Answers

Answered by hasiburjob
0

emplist1=[]

print(emplist1)

emplist1.append(9)

print(emplist1)

emplist1.append(10)

print(emplist1)

emplist2=[]

emplist2.extend(['a','b','c'])

print(emplist2)

emplist2[2]='e'

print(emplist2)

print('e')

Output:-

[]

[9]

[9, 10]

['a', 'b', 'c']

['a', 'b', 'e']

e

Similar questions