+ 1
What does it means "print(arr[:,2])"
It's been a long to read python so I need help
2 odpowiedzi
+ 2
Comma "," is used when you are working with multidimensional array. The contents of this bracket indicate that the slice corresponds to the second column[,2] in all rows[:,].
+ 1
Since you've included "machine" as your tag, I'll assume that you're talking about numpy, so
https://stackoverflow.com/questions/17277100/JUMP_LINK__&&__python__&&__JUMP_LINK-slicing-a-multi-dimensional-array/17277125#17277125
OR
ar = [1,2,3,4,5]
print(ar[:2]) # without comma I suppose
# [1, 2] output
https://code.sololearn.com/cAQBZ3dHmbKW/?ref=app