The instructions: Write a function validate\_input(string) which takes a command string in the format 'command arg1 arg2' and returns the pair ('command', [arg1, arg2]), where arg1 and arg2 have been converted to floats. If the command is not one of 'add', 'sub', 'mul', or 'div', it must raise InvalidCommand. If the arguments cannot be converted to floats, it must raise InvalidCommand.

Typical inputs and outputs:

validate\_input('add 2 3') -> ('add' [2. , 3.])

validate\_input('hahahaha 2 3') -> Raises InvalidCommand()

validate\_input('add six 3') -> Raises InvalidCommand()

Here is my code:

```
class InvalidCommand(Exception):
    pass

def validate_input(string):
"""
validate_input(str) -> (str, [float])

If string is a valid command, return its name and arguments.
If string is not a valid command, raise InvalidCommand

Valid commands:
  add x y
  sub x y
  mul x y
  div x y

Arguments x and y must be convertable to float.

"""
# your code here
    inlist = string.split(' ')
    commands = []
    strdigits = []
    floats = []
    output = []
    for x in inlist:
        if x.isdigit():
            strdigits.append(x)
        else:
            commands.append(x)
    for x in commands:
        try:
            x == 'add' or x == 'sub' or x == 'mul' or x == 'div'
            output.append(x)
        except ValueError:
            raise InvalidCommand(ValueError)
    for x in strdigits:
        try:
            float(x)
            floats.append(float(x))
        except ValueError:
             raise InvalidCommand(ValueError)
    output.append(floats)
    return tuple(output)

```

When I test it on the values where it is supposed to raise InvalidCommand(), It tells me "Your code must raise InvalidCommand(). But my code does. I checked for typos and there are not any. So did I do the whole raising statement wrong? Please show me how to fix this. Thanks.