Given a list of integers, return the sum of the first and last elements in the list. If the list is empty, return 0. If the list has only one element, return that element.
Example:
Input:
[5, 2, 7, 10, 1]
Output:
6
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.