-5

This is what I have so far.

print(listTest[3: ]) 

I am just unsure what to put on the other side of the semicolon. -1 gives me one less index then the answer. So I am asking how to get the true end of the list.

  • If you Google the phrase "Python list slicing", you’ll find tutorials that can explain it much better than we can in an answer here. – Prune Oct 22 '18 at 21:48
  • 1
    Possible duplicate of [How to slice a list from an element n to the end in python?](https://stackoverflow.com/questions/621354/how-to-slice-a-list-from-an-element-n-to-the-end-in-python) – Edgar Ramírez Mondragón Oct 22 '18 at 21:50

2 Answers2

2

listTest[3:]

Not having anything after the : means until the end of the list.

Joao Coelho
  • 2,838
  • 4
  • 30
  • 36
1

You can either put length of the array

listTest[3:len(listTest)]

OR

Leave it empty

listTest[3:]
Rarblack
  • 4,559
  • 4
  • 22
  • 33