Ad
  • Custom User Avatar

    What you are doing here is handling any error that your program might raise.
    What you are supposed to do is raise an Error if the number isn't an integer.

    For example, if you were supposed to raise an error if n was 2, then you would write:

    if n == 2: raise ValueError("***Put Error Message Here***")
    

    Or you may chose some other class instead of ValueError depending on what kind of Error occured in the program
    Here's a list of built in exceptions in Python.
    https://docs.python.org/2/library/exceptions.html

    In this problem, any of the classes will do. I would recommend using TypeError, since the argument is of the wrong type.