I dont understand this at all! PLZ help me

DO NOT ENTER CODE INTO THE COMPUTER! What will be printed by each of the print statements in the following code with this list

 ex = [5, 3, 0, 1, 2]

I dont understand this at all PLZ help meDO NOT ENTER CODE INTO THE COMPUTER What will be printed by each of the print statements in the following code with thi class=

Respuesta :

Answer:

See explanation

Explanation:

Given

[tex]ex = [5,3,0,1,2][/tex]

Solving (a):

print(ex[0:2])

This prints the elements from 0 index to 2-1

In other words, it prints index 0 and 1

Hence, the output is [5, 3]

Solving (b):

ex.append(8) --> This adds 8 to the end of the list

print(ex) --> This prints the updated list: [5, 3, 0, 1, 2, 8]

Solving (c):

ex.remove(0) --> This removes 0 from the list

print(ex) --> This prints the updated list: [5, 3, 1, 2, 8]

Solving (d):

ex.pop() --> This removes the last ite, from the list

print(ex) --> This prints the updated list: [5, 3, 1, 2]