+ 1

What does it means "print(arr[:,2])"

It's been a long to read python so I need help

19th Sep 2020, 10:37 AM
Abhay
Abhay - avatar
2 Answers
+ 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[:,].
19th Sep 2020, 11:15 AM
Kiarash Rahayi
Kiarash Rahayi - avatar
+ 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
19th Sep 2020, 10:59 AM
minirkk
minirkk - avatar