Is it None or int? (Type Error)
Hi guys! I'm back because I've got a type error that I don't know how to solve. Here's a piece of my function: books = {'harry potter': 3, 'the midnight library': 0, 'the alchemist': 1} def sell_books(): while True: book = input('Which book do you want? ').lower() # books we sell if book in books.keys(): copies = books.get(book) if copies >= 0: # HERE'S THE TYPE ERROR print('Book sold!') books.update({book: copies - 1}) The error says: " '>=' not supported between instances of 'NoneType' and 'int'." According to this, the None type is ''copies'' (that is ''books.get(book)'') but the type() function returns it actually as an int... type(copies) <class int> # I've also tried so: copies is None False I'm quite confused. Is copies None or is it int? And then, how can I do the comparison? I don't get it! D: