Advertisement
nordlaender

python yield

Nov 29th, 2012
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def bruteForceLeft(selected,index):
  2.     if index==len(left):
  3.         #print(selected)
  4.         yield selected
  5.     else:
  6.         selected[0].append(left[index])
  7.         bruteForceLeft(selected,index+1)
  8.         selected[0].pop()
  9.         bruteForceLeft(selected,index+1)
  10.  
  11. for option in bruteForceLeft(([],[]),0):
  12.     print(option)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement