Problem with skiping the if conditions in python

31 Views Asked by At

I need to create unique numbers for database.

First i'm getting all existing numbers from database:

conn.execute('SELECT numer FROM Brama')
BCheck = conn.getData()

Then i'm creating additional list:

bramy = []

and now with simple loop i'm creating new numbers:

while True:
    numer = random.randint(1,15)
    if numer not in BCheck or bramy:
        bramy.append(numer)
        print(BCheck)
        print(bramy)
        break

And 'if' is skipping conditions: enter image description here

BCheck is list of integers. Any ideas why?

I have tried to force BCheck to be integer, then i checked if BCheck sums(like integer should) and it works.This exact While true loop works with strings in different part of code.

0

There are 0 best solutions below