0

Hi I have a python code written as followed. Can someone please explain what these colons do?

edges = (data[0,0:-1]+data[0,1])/2.0
counts = data[1,1:]
Tyler Roper
  • 20,917
  • 6
  • 31
  • 53
Seoyeon Hong
  • 443
  • 2
  • 5
  • 8

1 Answers1

0

Taken from https://stackoverflow.com/users/482864/soulseekah

: is the delimiter of the slice syntax to 'slice out' sub-parts in sequences , [start:end]

[1:5] is equivalent to "from 1 to 5" (5 not included)

[1:] is equivalent to "1 to end"

[len(a):] is equivalent to "from length of a to end"

Retried from Colon (:) in Python list index

Community
  • 1
  • 1
Brent Knox
  • 178
  • 10