# Tutorials/Lists/Solutions

1. For example

```q)myname:"abigail"
q)last myname
"l"
q)-1#myname
,"l"
```

2. Copy the list into your q process...

```q)t?`o
4

q)where t=`o
4 17 19

q)t>`j			/ compare to return a boolean list
00011010111000110101b
q)sum t>`j		/ sum to get the total
10i
q)t where t>`j		/ return the values themselves
`n`o`k`l`m`m`m`m`o`o
```

3. Create your own mixed list and check that its type is 0h.

```q)d:("h";`p;1;2h;0b)
q)type d
0h
```
• Create a list i of ints, and a list s of symbols. Join i and s to form a new list, m.
```q)i:45 39 81i
q)s:`this`is`a`list
q)m:i,s
```
• Create a nested list n (AKA a list of lists), with two elements: i and s.
```q)n:(i;s)
q)n
45 39 81i
`this`is`a`list
```

4. Get the first element of each element using "first"

```q)first each mylist
"h"
"w"
1
1b
```

Get the first element of each element using indexing.

Note: Although we can specify every index in the top level, if an indexing level is omitted, every element is returned.\

```q)mylist[0 1 2 3;0]	/ specifying every index
"h"
"w"
1
1b
q)mylist[;0]		/ omitting the first level
"h"
"w"
1
1b
```

Back to Tutorials