Skip to content

Instantly share code, notes, and snippets.

@XertroV
Created December 15, 2015 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XertroV/45ff874396b93bc85dab to your computer and use it in GitHub Desktop.
Save XertroV/45ff874396b93bc85dab to your computer and use it in GitHub Desktop.
Password Trainer - simple script to remember a password and help you practise
#!/usr/bin/env python3
import getpass
import time
print("Please input your password carefully.")
password = getpass.getpass()
print("Thank you, please type it again to confirm")
p2 = getpass.getpass()
if password != p2:
print("Mismatching passwords, please try again.")
exit()
best_time = 99999999999
while True:
print('')
t1 = time.time()
p = getpass.getpass()
duration = time.time() - t1
if p != password:
print("Incorrect... %0.2f s" % duration)
else:
print("Correct! You took %0.2f s" % duration)
if duration < best_time:
print("New best time!")
best_time = duration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment