Mar-15-2023, 05:14 PM
Your original code works fine for me without any delay (Windows, Python 3.10, cmd shell). It would appear that the clear command does not execute immediately on your system. This is not a Python thing. This could be an OS thing or a shell thing or an IDE thing. What happens when you run it outside of spyder?
This is a version of your program that does not contain any hard-coded passwords. Enter the word you want to remember and do your testing. Exit testing and you can work on a different password.
This is a version of your program that does not contain any hard-coded passwords. Enter the word you want to remember and do your testing. Exit testing and you can work on a different password.
import os from time import sleep def password_test(): password = input("Enter a password: ") while True: os.system("cls") sleep(0.1) if input("What is the password: ") == password: print("Match") else: print("No match") if input("Run again (y/n)? ").lower() != "y": break while True: password_test() if input("Learn a different password (y/n)? ").lower() != "y": break