Skip to content

Instantly share code, notes, and snippets.

@prasadwrites
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save prasadwrites/a83661da8750a6f3e083 to your computer and use it in GitHub Desktop.

Select an option

Save prasadwrites/a83661da8750a6f3e083 to your computer and use it in GitHub Desktop.
All combination charachters
a = [ 'a','b','c','d']
b = []
length = len(a)
print(a)
print(length)
temp = 1
for k in range(1,length):
valk = k
for i in range(length):
for j in range(i+1,length):
temp = ""
k = 1
while(k != valk and k+j <= length):
#print("i%d j%d k%d" %(i, j, k))
temp = temp + a[j+k-1]
k += 1
if(k+j <= length):
#print("i%d j%d k%d" %(i, j, k))
b.append(a[i]+temp)
print(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment