Home > Mobile >  Iterate int variable to do in operator check
Iterate int variable to do in operator check

Time:12-19

I already referred the post enter image description here

CodePudding user response:

I think the problem is that (4) does not define a tuple with single item apparently hence you get TypeError: 'int' object is not iterable. That's why it stops at the line

if (r in (4)) and (f in (4)) and (y in (2,3)) and (h in (3)):

Maybe try replacing tuples with lists as follows (e.g. here list of one item):

>>> r = 5
>>> r in [4]
False

so your first if statement will become

if (r in [4]) and (f in [4]) and (y in [2,3]) and (h in [3]):

Update: as The Great suggested in comments adding comma to single item tuple solved the problem. Perhaps that should be the correct answer.

  • Related