In this python basi program, we will check for the anagram i.e. rearrangement of the letters of a word to another word, using all the original letters once.
Steps to solve the program
- Take a word as input and create a variable named combination and assign its value equal to 0.
- We have to find the number of words that can be formed by using letters available in the given word.
- Create a variable and assign it a value equal to the letters available in the input word.
- While the value of that variable is greater than 0 add 1 to combination variable and subtract 1 from the above variable.
- Print the output.
word = input("Enter a word: ")
combination = 0
characters = len(word)
while characters>0:
combination += characters
characters -= 1
print("Total combinations without repetaation: ",combination)
Output :
Enter a word: python
Total combinations without repetaation: 21