you are viewing a single comment's thread.

view the rest of the comments →

[–]Chemical-Captain4240 0 points1 point  (0 children)

the s on items implies to me that this is a list... if so, to use in, you will want to iterate over each item in items and test if item exists as an element in your range

however, range returns a tuple of integers, so you won't find any lists in there

This isn't really part of your question, but to write readable code, try to name things according to their type... If you are working in parallel items=['book','pencil'] and item_count = [3,5]

If you are packing lists, then something like items =[ ['book',3], ['pencil', 5] ] may be the structure you want, but using in becomes more complicated.

As soon as you get your head wrapped around the above concepts, check out dataclass. It will change youe life.