Qurak

Get elements of lists

How-to 9 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
v = Range[10] ^ 2
Output
{1, 4, 9, 16, 25, 36, 49, 64, 81, 100}
Step 2
Part[v, 3]
Output
9
Step 3
v[[3]]
Output
9
Step 4
v[[1 ;; 5]]
Output
{1, 4, 9, 16, 25}
Step 5
v[[5 ;; 8]]
Output
{25, 36, 49, 64}
Step 6
v[[-7 ;; ]]
Output
{16, 25, 36, 49, 64, 81, 100}
Step 7
m = Partition[Range[25] ^ 2, 5]
Output
{{1, 4, 9, 16, 25}, {36, 49, 64, 81, 100}, {121, 144, 169, 196, 225}, {256, 289, 324, 361, 400}, {441, 484, 529, 576, 625}}
Step 8
MatrixForm[m]
Output
MatrixForm[{{1, 4, 9, 16, 25}, {36, 49, 64, 81, 100}, {121, 144, 169, 196, 225}, {256, 289, 324, 361, 400}, {441, 484, 529, 576, 625}}]
Step 9
m[[1]]
Output
{1, 4, 9, 16, 25}

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client