Python program to check for the anagram.

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
  1. Take a word as input and create a variable named combination and assign its value equal to 0.
  2. We have to find the number of words that can be formed by using letters available in the given word.
  3. Create a variable and assign it a value equal to the letters available in the input word.
  4. While the value of that variable is greater than 0 add 1 to combination variable and subtract 1 from the above variable.
  5. 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
				
			

check leap year.

generate random numbers.

Leave a Comment