Question: I'm using Atom to write LaTeX and C++. When I use for example a snippet:

Prefix 'fr' expands to '\frac{$1}{$2} $3' meaning that typing 'f r TAB' creates the sentence '/frac{}{}' and places the cursor at position '$1', pressing TAB again moves the cursor to '$2', TAB again moves the cursor outside of the expression in position '$3'.

However, support that I have a snippet 'sq' which expands to '\sqrt($1)'. This means that typing 's q TAB' creates the text '\sqrt()' and places the cursor in position '$1'.

Now suppose I want to combine both snippets.

'f r TAB' expands to '\frac{$1}{$2}', I then type '2' to insert the number '2' in the position of '$1', I press TAB to jump to position '$2' and now I want to insert 'sqrt(2)'. Then I type 's q TAB' and it expands to the following total expression:

'\frac{2}{sqrt($1)}'

The cursor is in '$1' I then type '2' and the expression now is:

'\frac{2}{sqrt(2)}'

Now if I press TAB again it will indent right after 2, like this:

'\frac{2}{sqrt(2...........)}'

What I would like it to do is go to the next position of '\frac{$1}{$2} $3', that is, position '$3' outside of the frac expression so I can continue typing without having to press right arrow, right arrow, etc.

Is there any text editor that can do this, even if it uses plugins to achieve it? It would be great for me.

Answer: 
`in` checks membership: `a in b` is true if and only if `a` is a member *contained by* `b`.

Since `availableNums` is a tuple of ints, `selectedNumbers`, which is a list, isn't a member. You seem to be wanting to check whether `selectedNumbers` is a *subset* of `availableNums`.

You can either check each item in a loop:

```
for s in selectedNumbers:
    if s not in availableNums
        ....

```

Or you can convert them to sets, if you're okay with checking all at once and failing completely if *any* of the selected numbers are invalid:

```
if not set(selectedNumbers) < set(availableNums):
    ....

```

Note that `<` here, applied to sets, is the subset operator.

---

Also, as noted in a comment, `raw_input` returns a string, but you're attempting to treat it as an integer. You can use `int()` to parse the input string.
`selectedNumbers` is a list. You are checking if the whole list is in `availableNums`, not if each number in `selectedNumbers` is in `availableNums`.

It sounds like you want something like:

```
for selectedNumber in selectedNumbers:
    if selectedNumber not in availableNums:
        # selectedNumber from selectedNumbers is not in availableNums

```

Edit: As [hatshepsut](https://stackoverflow.com/users/3346095/hatshepsut) pointed out, your code places strings in `selectedNumbers`, not integers. Use [`input`](https://docs.python.org/2/library/functions.html#input) instead of `raw_input`1 or convert to [`int`](https://docs.python.org/3/library/functions.html#int).

1 For Python 2. For Python 3, see [What's the difference between raw\_input() and input() in python3.x?](https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x)