Last active
July 9, 2022 19:19
-
-
Save zhangzhhz/231d0e329245967ca893e7969c5a41b4 to your computer and use it in GitHub Desktop.
Print all English alphabets in order but at random positions on one line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from string import ascii_lowercase, ascii_uppercase | |
from random import shuffle | |
from time import sleep | |
for letters in [ascii_lowercase, ascii_uppercase]: | |
l = list(range(26)) | |
shuffle(l) | |
c_list = [" "] * 26 | |
for c in letters: | |
c_list[l.pop()] = c | |
print(''.join(c_list), end="\r", flush=True) | |
sleep(0.1) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment