Creating a list containing all combinations

I need it to include all combination of numbers and letters, it can only be a total of 3 characters.

So if it is 1 letter it has to have 2 number. If it has 2 letters it needs to be 1 number. Any help or ideas on how to do this.
closed account (4Gb4jE8b)
Use a giant for loop with multiple iterators, one for each character (first second third). Increase third to max amount (26 letters plus 10 digits 0-9 = 36), then increase iterator for second digit once and repeat third iterator. Do this until you have all of the seconds done, and increase first iterator by one. Then put limits on what the third/second characters can be based on first character, and what third character can be based on first/second characters. But that does it in an organized fashion.
The rules as you gave are a bit contradictory. It might be best to organize them clearly:

A list of all 3 character strings containing numbers and letters
With at least one number
And with at least one letter


Hopefully I've captured the rules correctly. Getting to the essence of the problem is one of the more important aspects of writing software. One must always first capture the requirements accurately and succinctly.

One way to accomplish this might be to first generate all alphanumeric combinations and then filter the ones that don't match the rule.

Generate all 3 character sequences from 000 to ZZZ (Edited for correctness)
Filter the sequences that don't have at least one letter
Filter the sequences that don't have at least one number
Store the sequence that passes both filters in the list
Last edited on
Topic archived. No new replies allowed.