Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

just a simple question for now I guess:

I have a list:

list={{1, 2, 1}, {1, 10, 1}}

I simply want to Drop the last element of the two entries of the list, that is the 1's at the end. I tried it this way:

Table[Drop[list[[x]], -1], {x, 1, Length[list]}]

but I don't like it this way. I feel I'm always stuck on using this Table-function,and I'm pretty sure this can be done in a much easier way

share|improve this question

marked as duplicate by Yves Klett, Kuba, Artes, Simon Woods, belisarius May 8 '14 at 12:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

duplicate? :) every last element from list –  Kuba May 8 '14 at 10:35
@Kuba Complement[Duplicate[]] ;-) but voting to close anyway because similar questions around here have tons of good answers on that topic, esp. here –  Yves Klett May 8 '14 at 10:37
@YvesKlett :) agree. Also related: 4030 –  Kuba May 8 '14 at 10:39
I'd use list[[All,;;-2]] –  Leonid Shifrin May 8 '14 at 10:40
@LeonidShifrin This is just the kind of question that will get a dozen brilliant answers even if it is kind of RTFM :D –  Yves Klett May 8 '14 at 10:43

1 Answer 1

How about


This should perhaps be the shortest way to do it.

share|improve this answer
That's great..thanks..didn't know Most until now.. –  holistic May 8 '14 at 10:32
learn Map(/@),and then Apply(@@) and Apply[f,expr,{1}](@@@) –  Apple May 8 '14 at 11:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.