Monday , December 18 2017
Home / Python / Anagram Generator in python

Anagram Generator in python

Here is a python program for anagram generator in python language. Read here to know about what is an anagram

def anagram(s):
    n=len(s)
    if n == 1:
        return s
    sb=[]
    for i in range(n):
        sb.append(s[i])
        rval=anagram(s[0:i]+s[i+1:n])
        if isinstance(rval,str):
            sb[i]=sb[i]+rval
        if isinstance(rval,list):
            c=sb[i]
            sb[i]= for x in range(len(rval))]

    if(n==2):
        return sb
    else:
        c=[sb[x][h] for x in range(len(sb)) for h in range(len(sb[x]))]
        return c

s=anagram(input("Enter String: "))
print(s)
print("Total String",format(len(s)))

OUTPUT:

python program for anagram generator
anagram generator in python

Tags: anagram generator program in python, anagram solver in python.

Also See:   Block puzzle or jigsaw puzzle program in python

One comment

  1. Great work Admin. I dont know that program would be that simple.

Leave a Reply

Your email address will not be published. Required fields are marked *