Hey guys.

I'm trying make a loop that goes through "AAAA" to "ZZZZZZ" but I only want to loop through cases where only 2 letters are used. For example "DBBB" HSHS" "LLLS" and so on. What is the best way to make this algorithm?
Outer loop that iterates through each combo of two letters. AB, AC, AD, ...

Inner loop that creates combinations of the two letters.

How would you create all 2 letter combinations with 2 different letters?
If only two letters are used, you basically have binary numbers. Loop through all combinations of 2 letters, and for each combination, get all the 4-digit to 6-digit binary numbers and replace the 0s with your first letter and 1s with your second letter.
If len(set(letters)) <= 2:
Iterate
It's probably in the book.
can you make all 2 letter combinations of length N? ( think recursion )

just loop i from 4 to 6 and make all possible 2 letter combinations of length i.
by
Knuth “The Art of Computer Programming” Vol 4A Ch. 7.2.1.3 “Generating all Combinations” has lots of material on this topic.
Go through all letters and compare them. That's it. And this is as explanatory as your question is.