Q:

String indices must be integers and while issue

I am writing some code for school homework. The assignment is this:
Write a code which will read book codes till "000" is entered and then split the books into two categories depending on the first 4 digits entered ISBN and ISSN.
NOTE: Use str and check the prefix of the code (in which case ISBN and ISSN). 
Here is my code:
bookarray = []
booknumber = str(input("Give me a book code - Type 000 if you want to cancel"))
while booknumber != "000":
   bookarray.append(booknumber)
   booknumber = str(input("Give me a book code - Type 000 if you want to cancel"))
   if booknumber[0,4] == "ISBN":
       isbnarray = booknumber
   elif booknumber[0,4] == "ISSN":
       issnarray = booknumber
print(issnarray)
print(isbnarray)

Any help regarding the same would be appreciated! I am in my first year in python at school.
EDIT: The expected output should be two lists with the books' code numbers. 
Currently, I face an autonomous loop on "while" which I am not sure of how and why.

A:

if booknumber[0,4] == "ISBN":

You're passing a tuple as index to booknumber which explains the error message ("indices must be integers"). You want a slice:
if booknumber[0:4] == "ISBN":

In that case you'd be better off with 
if booknumber.startswith("ISBN"):

Also, if you're using python 2, entering 000 and passing it to str(input()) just yields "0" since input() evaluates your expression and 000 is just 0. It's OK for python 3, but for python 2, switch to raw_input() (or just ask user to enter 0 to quit, and test for "0" for instance. BTW input is unsafe in python 2).

