Computer Science, asked by shivam2305, 4 months ago

If a=(1,2,3,4), a[1:-1] is then

Answers

Answered by snehalkokate
1

Answer:

your question might be wrong check it again

Answered by varshamittal029
0

Concept:

In the same manner that we use slicing in strings and lists, we can do it in tuples. Tuple slicing is a technique for obtaining a range of items.

Given:

a=(1,2,3,4)

Find:

Find a[1:-1].

Solution:

The slicing operator is used to achieve tuple slicing.

Syntax: tuple_name[start:stop:step]

Furthermore, the 'step' portion is not necessary to be mentioned. If we don't mention the step part, the compiler assumes it's 1.

The 'stop' parameter tells where to stop excluding the index given.

Negative indexes are used to print the elements from the end.

a=(1,2,3,4)

a[1:-1] will print from index 1 to last first.

a[1:-1]=(2, 3)

Similar questions