Print string with any combination

 from itertools import permutations 

str="abcdefghijklmnopqrstuvwxyz"
y=int(input("Enter range of letters of alphabet ="))
your_str=str[0:y]
print("You entered  ="your_str
m=int(input("How many string do you want? ="))
r=int(input("Enter range of letters Combination ="))
permutation = [''.join(xfor x in permutations(your_str,r)] 
x=tuple(permutation)
print(', '.join(x[0:m]))

Comments

Popular posts from this blog

Prime Number

star pattern

Basic Calc using Python Tkinter