Skip to content

Instantly share code, notes, and snippets.

@albal
Created April 5, 2020 01:09
Show Gist options
  • Select an option

  • Save albal/6ca1f5100a1fa56ef28c1824d49cf715 to your computer and use it in GitHub Desktop.

Select an option

Save albal/6ca1f5100a1fa56ef28c1824d49cf715 to your computer and use it in GitHub Desktop.
Scramble Name
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