0
$\begingroup$

I have a list with 1000 elements, and I want to delete all elements from index 400 (including) until the last element.

$\endgroup$
  • 3
    $\begingroup$ Do you want or need anything more than list = list[[1;;399]] ? $\endgroup$ – High Performance Mark Nov 4 at 8:23
  • $\begingroup$ @HighPerformanceMark: Thank you. I added your comment as an answer. $\endgroup$ – tommsch Nov 4 at 8:31
  • 1
    $\begingroup$ Drop[val, {400, -1}] $\endgroup$ – OkkesDulgerci Nov 4 at 15:32
1
$\begingroup$

As commented by "High Performance Mark". This is the way to go:

val=Table[i,{i,1,1000}];
val=val[[1;;399]];
$\endgroup$

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