Okay, I'm trying to generate a 10 character string containing specific characters. With the conditions being, the letters can NOT be repeats (but the numbers CAN), and the string can ONLY contain a total of TWO letters, no more, no less. The final string output MUST be 8 numbers, and 2 letters.
numbers = ["1", "2", "3"]
letters = ["X", "Y", "Z"]
i.e. the string output should be similar to
123X21Y213
The problem is, I don't know how to do this, elegantly. I did create a solution, but it was over 500 lines, and it involved constantly checking the previous character of the string. I'm really bad at this, and need something simpler.
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire