import random list2 = ['TRUE','FALSE' , 'FALSE', 'FALSE', 'FALSE','FALSE','FALSE' ] current = [] def randompicker(): for i in range(4): current.append(random.choice(list2)) randompicker() s = current
for x in s: if 'TRUE' in x: print (x)
if 'TRUE' in x
if 'TRUE' in s:
Quote: You can use this syntax: Python if myItem in list: # do something Also, inverse operator: Python if myItem not in list: # do something It's work fine for lists, tuples, sets and dicts (check keys). Note that this is an O(n) operation in lists and tuples, but an O(1) operation in sets and dicts.
if myItem in list: # do something
if myItem not in list: # do something
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)