Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def all_partition(curPart, start, n, str):
  2. if (start >= n):
  3. allPart.append(curPart)
  4. print (allPart)
  5.  
  6. i = start
  7. while i < n:
  8. str1 = str[start : i+1]
  9. curPart.append(str1)
  10. if(len(allPart) > 0):
  11. allPart.pop()
  12. all_partition(curPart, i+1, n, str)
  13. curPart.pop()
  14. i = i + 1
  15.  
  16. curPart = []
  17. allPart = []
  18. str = "abcd"
  19. n = len(str)
  20. all_partition(curPart, 0, n, str)
  21. print(test)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement