We informally define the term corresponding element as follows: The first element and the last element of a list are corresponding elements. Similarly, the second element and the second last element are corresponding elements. The third element and the third last element are corresponding elements -- and so on. Given that the variable a is associated with a list, write an expression for the corresponding element of a[i].

Respuesta :

fichoh

Answer:

a[i] = a[len(a) - i - 1]

Explanation:

Based on the definition of corresponding elements above,

First element of a list and last element are corresponding :

Using this :

Given a list defined as 'a'

First element of list is at index 0

Last element of a list is at index ; len(a) - 1

For a list containing 10 elements:

Second element corresponds to second to the last element

Second element is at index 1;

Second to the Last element is at index 8

(since indexing starts from 0)

Second element = a[1]

Second to the last element = a[len(a) - i - 1]

Hence,

a[i] = a[len(a) - i - 1]