(Apr-13-2017, 07:59 AM)jkk30 Wrote: I stack in if . What do I need to write there to control columns
def on_bingo_tabel(bingo): for i in range(len(bingo)): for j in range(len(bingo[i])): if ????????: return False return True bingo = [[1, 30, 34, 55, 75], [10, 16, 40, 50, 67], [5, 20, 38, 48, 61], [4, 26, 43, 49, 70], [15, 17, 33, 51, 66]] ranges=[(1,15) ,(16,30),(31,45),(46,60),(61,75)] print(on_bingo_tabel(bingo))
i-th element of line compared to the bounds from i-th element of
ranges
The one-liner (don't put in your holework unless you really understand how it works):
def check(bingo): return any(any(not minvalue <= actual <= maxvalue for actual,(minvalue,maxvalue) in zip(line,ranges)) for line in bingo)
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net