id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

getFirstAndLast


getFirstAndLast(myList) - Give myList, a list with at least one element, return another list with only the first and last elements of myList. For example, given [1,2,3,4,5] to your function, the return value would be [1,5].


getFirstAndLast([1, 2, 3, 4, 5]) → [1, 5]
getFirstAndLast([1]) → [1, 1]
getFirstAndLast([0, 0, 0, 0, 0, 0]) → [0, 0]

...Save, Compile, Run (ctrl-enter)

def getFirstAndLast(myList):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Post-solution available

Copyright Nick Parlante 2017 - privacy