I'm experimenting and would like 'yes' to be printed only if 5 is not in the list, but I want to look in each list. This prints out two yeses. How do I get it to print just one 'yes'? x = [[1,2,3],[2,4,6],[8,4,5,6],[9,8,7]] for num in x: if 5 in num: break else: print 'yes'