Write a function named find_average_first_index(input_list, input_letter)
that accepts a list of strings and a single letter.
- The function should return the average index of the first occurrence of the
input_letter
among all strings in the list that contains the input_letter
.
- If a list element does not contain the given letter, skip it. Do not add it to the number of elements when calculating the average.
- If no list element contains the given letter, return
-1
.
Example: for the sample_list
in the template code and the input letter 'o'
, the function should return 6.33
:
'Black Mirror'
: 'o'
at index 10
'Breaking Bad'
: no letter 'o'
(ignored)
'Stranger Things'
: no letter 'o'
(ignored)
'The Leftovers'
: 'o'
at index 8
'How I Met Your Mother'
: 'o'
at index 1
(10 + 8 + 1) / 3 = 6.33