sK()
What does sK() do?
sK() selects the first K elements in an array/string inside of it. It can be combined with oK() to get any range of values in a string/array
from ArrayExpressions import arrex
lst = [1, 2, 3, 4, 5]
output = arrex.evaluate(lst, 's3(x)')
print(output) # [1, 2, 3]Other Important Information:
| Input | Any array or string |
|---|---|
| Does it create a new scope? | No |
| Output | An array of the first K values |
| K | Any number |
| I | The K value |
| Example | s3("Hello") |
| Example Explanation | This returns "Hel" because those are the first 3 characters in the string |