Created
April 5, 2020 01:09
-
-
Save albal/6ca1f5100a1fa56ef28c1824d49cf715 to your computer and use it in GitHub Desktop.
Scramble Name
This file contains hidden or 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
| import sys, time, random, string | |
| name = "Daniel Michael Blake Day-Lewis" | |
| length = len(name) | |
| output = "" | |
| def randomString(stringLength=10): | |
| """Generate a random string of fixed length """ | |
| letters = string.ascii_lowercase | |
| return ''.join(random.choice(string.ascii_letters) for i in range(stringLength)) | |
| for t in range(length): | |
| for x in range(10): | |
| if name[t].isupper(): | |
| c = random.choice(string.ascii_uppercase) | |
| else: | |
| c = random.choice(string.ascii_lowercase) | |
| output = name[:t] + randomString(length - t) | |
| print("\r" + output, end='') | |
| sys.stdout.flush() | |
| time.sleep(0.04) | |
| print("\r" + name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment