Hello, I have made a programme for finding cominations of a number from the user, it is designed to take any length and then tell the user how many combinations there are. However im not sure how to find how many combernations there are. I have googled it and there are very complicated formula's or formula's which arn't relavant. What would i need to put in my for loop? I have marked it out in the code. This is what i have:
class getNum:
def __init__(self): # Runs when class is called
self.word = int(input('Enter a number'))
def workOutCombinations(self):
emptyList = []
self.string = str(self.word)
self.length = len(self.string)
for combLength in range(1, self.length + 1):
emptyList.append(combLength)
for finalAnswer in emptyList: # Too work out combo's
Ans = emptyList[finalAnswer] * emptyList[finalAnswer + 1]
print(Ans)
def printNum(self): # returns the word
return(self.word)
getNumObject = getNum() # Makes the class object
print(getNumObject.printNum()) # prints out the word
getNumObject.workOutCombinations()