-5

Assume I input list containing [1,2,3,4]. How do I make it so it returns another list only containing the first and last entry ([1,4]).

Jet
  • 1
  • 1

1 Answers1

0

To returns another list only containing the first and last entry you may

    a=[1,2,3,4]
    b=[a[0], a[-1]]
    b
    [1, 4]
Heikki
  • 2,214
  • 19
  • 34