0

what are slices in arrays

slices

1st Jan 2019, 9:05 AM
Andrew
Andrew - avatar
3 Réponses
+ 5
Just an annotation: you can use slices as independent objects in python. a = [1, 2, 3, 4] b = (5, 6, 7, 8) sl = slice(-2, None, 1) # last two items, equivalent to [-2::1] print(a[sl]) # output: [3, 4] print(b[sl]) # output: (7, 8)
1st Jan 2019, 9:40 AM
Anna
Anna - avatar
+ 1
Generally the "slices in array" concept is being dealt in perl scripting language.
1st Jan 2019, 6:02 PM
Nishanth
Nishanth - avatar