My if-clauses that check if the chars-variable is "letters" or "Letters" ("numbers" or "Numbers") doesn't work like I want it to... It changes the chars-variable even when the clause is not called. I already tried a few things but nothing seems to work. (Testing prints added)
(I do not want to do anything illegal with this programm. I just want to learn about the itertools-module.)
Code:
import itertools, sys
chars = input("Chars:" + " ")
max_length = input("Max length:" + " ")
password = input("Password:" + " ")
max_length = int(max_length)
print() #
print("Chars test:", chars) #
if chars == "letters" or "Letters":
    chars = "abcdefghijklmnopqrstuvwxyz"
    print("Chars test:", chars) #
print("Chars test:", chars) #
if chars == "numbers" or "Numbers":
    chars = "0123456789"
    print("Chars test:", chars) #
print("Chars test:", chars) #
print()
input("Press enter to start...")
print()
length = (max_length + 1) - max_length
while length <= max_length:
    results = itertools.product(chars, repeat = length)
    for result in results:
        result = "".join(result)
        if result != password:
            print("Password not found yet:", result)
        else:
            print()
            print("Password found:", result)
            print()
            input("Press enter to exit...")
            sys.exit()
    length = length + 1
print()
print("Couldn't find the password.")
# = Remove when solved.
