-3
__author__ = 'Mark'
import itertools

def power(num, x=1):
  result = 1;
  for x in range(x):
    result = result * num
  return result
print power(4,7)

count = 0
for subset in itertools.product('0123456', repeat = 4):
     print(subset)
     count +=1
     print count

I need to enumerate all possible permutation of a 4-digit number using 0-6 only with repetition.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • 2
    where is your attempts? – Anton Protopopov Dec 11 '15 at 08:03
  • 1
    @user5667787 Have a look at the `itertools` module in python - https://docs.python.org/2/library/itertools.html & try to solve the question. If you are still facing issues then you can reach out. Without an attempt to solve the problem the SO community would not help! – KartikKannapur Dec 11 '15 at 08:22
  • Possible duplicate of [Python permutation](http://stackoverflow.com/questions/10369300/python-permutation) – dhke Dec 11 '15 at 09:07

1 Answers1

0

Take a look at product, permutations, combinations, combinations_wit_replacement functions from itertools.

venpa
  • 4,268
  • 21
  • 23