Advertisement
alxczr

2 letter plate combinations

Mar 18th, 2023
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  2. def generatePlates(length):
  3.   for i in range(1, 2**length-1):
  4.     s = bin(i)[2:].zfill(length)
  5.     for let_1 in alphabet:
  6.       for let_2 in alphabet:
  7.         if let_1 != let_2:
  8.           yield s.replace('0',let_1).replace('1',let_2)
  9.  
  10. length4 = generatePlates(4)
  11. length5 = generatePlates(5)
  12. length6 = generatePlates(6)
  13. #print(*length4)
  14. #print(*length5)
  15. #print(*length6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement