8.3k views
3 votes
Given that k and j each refer to a non-negative int and that play_list has been defined to be a list with at least j+1 elements, write an expression that evaluates to a new list containing all the elements from the one at index k through the one at index j of list play_list . Do not modify play_list .

User Gabba
by
6.9k points

1 Answer

2 votes

Answer:

The answer to this question can be given as :

Expression:

play_list[ k : j + 1]

Explanation:

In the question, it is given that variable k and j is a positive variable and play_list is a variable that is a list type variable that is initialized in the list which has at least the elements of j+1.

The expression for this is play_list[K:j+1]. Where play_list is used the k to ':' slicing in j+1.

User AminMal
by
6.5k points