How is it working now? I think your issue is the fact that it is looking for you to input an integer but you are entering a string therefore the error
To fix this:
remove the int() on your inp input
Also: if q is set to an integer earlier you need to specify this later
like this:
if inp == str("q")
Did you try this?
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.