Numpy integer nan

Is there a way to store NaN in a Numpy array of integers? I get: a=np.array([1],dtype=long) a[0]=np.nan Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: cannot convert float NaN to integer Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you … Read more

Split an integer into digits to compute an ISBN checksum

I’m writing a program which calculates the check digit of an ISBN number. I have to read the user’s input (nine digits of an ISBN) into an integer variable, and then multiply the last digit by 2, the second last digit by 3 and so on. How can I “split” the integer into its constituent digits to do this? As this is a basic homework exercise I am not supposed to use a list.