pyassistant

Average at Even Index

Given a list of integers, return a new list where each element at an even index is replaced by the average of the element and its preceding element.

Example:

Input:
[3, 6, 8, 2, 10, 7]
Output:
[3.0, 6.0, 7.0, 5.0, 10.0, 7.0]

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.