i am trying to write a code as part of a simulator that will read a list of numbers and compare them to a secondary list of numbers and tell you how many numbers there are that are less then the first number. for example

```
X=[5,20,14,1,7]
Y=[2,12,9,5,4,6]

```

the code will take the first X value 5 and see how many of the Y values are less then 5. so the output Z would look something like

```
Z=[2,6,6,0,4]

```

i am not very familiar with these concepts at all, i am wondering how i would go about making a function for this type of work. how would i make a for loop that would go through and compare the numbers like that? also is it possible to combine and sort the lists from smallest to largest and then just search that list for the X value and print its position in the list?