Mar-15-2023, 12:47 AM
(This post was last modified: Mar-15-2023, 12:47 AM by davidorlow.)
Ok, I'm a struggling programmer. Dabbled in it for years and never get any better than a basic hello world programmer. LOL.
I'm trying to write a script that tests me on a password. I'm terrible at remembering passwords and I shouldn't be writing down my admin passwords. They should be in my head. So, I was searching for a program that would test me and found there are none. So, I figured, maybe I'll see if I can figure it out in Python. The script worked until I put the clear statement in it. I'm trying to clear the screen so I can't look at it when it runs again... I need to memorize it. But, for whatever reason I'm not seeing, when I put the clear there, it asks the question real quick "what's my password" then clears the screen. I'd think since it's below the input line, it would display the question and wait for me to input something before it moves on to the next line to clear it. But it's not even making it to the run again part. The clear screen is wiping out the prompt to ask for the password.
If you all told me I just found a bug in python, that would make my day. I know I'm doing something elementary stupidly wrong.
I'm trying to write a script that tests me on a password. I'm terrible at remembering passwords and I shouldn't be writing down my admin passwords. They should be in my head. So, I was searching for a program that would test me and found there are none. So, I figured, maybe I'll see if I can figure it out in Python. The script worked until I put the clear statement in it. I'm trying to clear the screen so I can't look at it when it runs again... I need to memorize it. But, for whatever reason I'm not seeing, when I put the clear there, it asks the question real quick "what's my password" then clears the screen. I'd think since it's below the input line, it would display the question and wait for me to input something before it moves on to the next line to clear it. But it's not even making it to the run again part. The clear screen is wiping out the prompt to ask for the password.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import os repeat = "y" while repeat = = "y" : mypassword = "test123" guesspassword = input ( "What is the password: " ) if guesspassword = = mypassword: print ( "match" ) input ( "Press Enter" ) else : print ( "no match" ) print ( "Password is " , mypassword) input ( "Press Enter" ) repeat = input ( "Run again?" ) os.system( 'cls' ) |