I'm a beginner to Python and I decided to make a permutation finder program.
Have fun and don't question the name. :)
Generate Every Possibility
__author__ = 'matrixdevuk'
import itertools, sys, signal
if sys.version_info < (3,4,0):
print("This program requires a minimum Python version of 3.4. Please consider upgrading.")
sys.exit()
def signal_handler(signal, frame):
print("")
print("")
print("Goodbye. :)")
sys.exit()
signal.signal(signal.SIGINT, signal_handler)
def run(letters):
i = 0
for word in itertools.permutations(letters):
i += 1
word = "".join(word)
print("[" + str(i) + "] Found: " + word)
print()
print("-----------------")
print("Complete.")
print(" _ _")
print(" /_\ _ __ _ __ | | ___")
print(" //_\\\| '_ \| '_ \| |/ _ \\")
print("/ _ \ |_) | |_) | | __/")
print("\_/ \_/ .__/| .__/|_|\___|")
print(" |_| |_|")
print("a permutation finder by matrixdevuk")
print("do not question the name")
print()
uinput = input("Letters: ")
if uinput != "":
run(uinput)
else:
print("Error in validation; please restart.")
sys.exit()
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.