So I have a class Panini, which I have to initialize, but it keeps getting stuck in the line assert isinstance(stickers, (int, tuple, set, list)), 'invalid stickers' and when I remove the line it gets stuck in the next isinstance, can somebody tell me what I'm doing wrong here?
class Panini:
def __init__(self, stickers):
self.stickers = stickers
#test if stickers is integer or a list/tuple/set of integers
assert isinstance(stickers, (int, tuple, set, list)), 'invalid stickers'
if isinstance(stickers, (set, tuple, list)):
try: int_list = [int(x) for x in stickers]
except ValueError:
raise 'invalid sticker'
#if list or tuple contains duplicate integers(stickers) then these must be included in the collection only once
if isinstance(stickers, (list, tuple)):
my_set = set(stickers)
if isinstance(stickers, tuple): stickers = tuple(my_set)
else: stickers = list(my_set)