Hi I'm getting the error TypeError: argument of type 'int' is not iterable when i run my program and don't know where I'm going wrong.
My code is:
class loan:
global loanlist
loanlist = []
def loanbook(self, name, ISBN, author, title):
self.name = name
self.ISBN = ISBN
self.author = author
self.title = title
self.data = loanlist.append(self.name)
self.data = loanlist.append(self.ISBN)
self.data = loanlist.append(self.author)
self.data = loanlist.append(self.title)
class book:
global booklist
booklist = []
def addbook(self, ISBN, author, title, stock):
self.ISBN = ISBN
self.author = author
self.title = title
self.stock = stock
self.data = booklist.append(self.ISBN)
self.data = booklist.append(self.author)
self.data = booklist.append(self.title)
self.data = booklist.append(self.stock)
class library:
def issamebook(self, name, ISBN, author, title):
for i in range(len(booklist)):
if ISBN in booklist[i]:
if author in booklist[i+1]:
if title in booklist[i+2]:
print "Found book match at position ", i
booklist[i+3] = booklist[i+3] - 1
else:
print "book not found"
else:
pass
else:
pass
if __name__ == "__main__":
a=book()
a.addbook("1234", "John", "Book 1", 1)
a.addbook("2345", "Jim", "Book 2", 1)
print booklist
b=loan()
b.loanbook("Steven", "1234", "John", "Book 1")
b.loanbook("Tom", "2345", "Jim", "Book 2")
print loanlist
c=library()
c.issamebook("Steven", "1234", "John", "Book 1")
print booklist
Can someone give me a clue on what to do. Thanks.