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/c0c6eeb4d6119ec01c2a to your computer and use it in GitHub Desktop.

Select an option

Save prasadwrites/c0c6eeb4d6119ec01c2a to your computer and use it in GitHub Desktop.
All combinations printing numbers
a = [ 2,2,3,4]
b = []
print(a)
temp = 1
length = len(a)
for k in range(1,length):
valk = k
for i in range(length):
for j in range(i+1,length):
temp = 1
k = valk
while(k != 0 and k+j <= length):
temp = temp * a[j+k-1]
k -= 1
if(k+j <= length):
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