Trouble navigating through my loops in Python - python

I have already asked people around me and tried countlessly to get this fix program. The program should be able to add the users websites and passwords as many times as they want to, and show the websites and password they selected.
For now when you answer would you like to add another website? with yes it dosn't re ask for a new website name and password but just repeats the question would you like to add another website?, also when you have entered in a website name and password and answer would you like to add another website? with no then selected option 1 to see existing accounts, it repeats would you like to add another website?, when this should even come up at option one
Inputs and how it should output:
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully 1
You have no stored websites and passwords
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully 2
What is the name of the website/app your are adding? instagram
What is the password of your {instagram} account? bob91
Would you like to add another website? yes
What is the name of the website/app your are adding? facebook
What is the password of your {facebook} account? bob92
Would you like to add another website? no
1) Find your existing passwords
2) Save a new password for your apps
3) See a summary of your password locker
4) Exit password locker successfully 1
enter the app you want to find the password for instagram
websitename = instagram
password = bob91
Full code:
vault_apps = []
app_name = ""
def locker_menu_func():
print('''You have opened the locker,
Please select what you would like to do,''')
locker_menu_var = input('''Press: \n1) find your existing passwords \n2) save a new password for your apps\n3) see a summary of your password locke \n4) exit password locker successfully\n---------------------------------------------------------------------------------
''')
print('''----------------------------------------------------------------''')
while True:
if locker_menu_var == "1":
while len(vault_apps) < 1:
print('''you have nothing stored''')
if len(vault_apps) > 1:
print(vault_apps)
break
break
if locker_menu_var == "2":
app_name = input('''
What is the name of the website/app your are adding?
''')
app_password = input('''What is the password of your {} account?
'''.format(app_name))
vault_apps.append([app_name, app_password])
while True:
ask_again = input('''Would you like to add another app and password?
''')
if ask_again.lower() == "yes":
locker_menu_var = "2"
elif ask_again.lower() == "no":
locker_menu_func()
else:
print("please enter a valid response") #should repeat if user want to add another website

Your code does not work because you do not break from a while True:-loop:
while True:
ask_again = input('''Would you like to add another app and password?''')
if ask_again.lower() == "yes":
locker_menu_var = "2" <--- does not leave while loop
elif ask_again.lower() == "no":
locker_menu_func()
else:
# etc.
Keep your methods small and handling one concern to simplify your control flow, example:
vault_apps = {}
# ,2,Hallo,Yuhu,y,Hallo2,Yuh,n,3,4
def menu():
print('\n'+'-'*40)
print('1) find your existing passwords')
print('2) save a new password for your apps')
print('3) see a summary of your password locker')
print('4) exit password locker successfully')
print('-'*40)
k = None
while k not in {"1","2","3","4"}:
k = input("Choose: ")
return int(k) # return the number chosen
def input_new_app():
global vault_apps
app = None
while not app:
app = input("What is your apps name? ")
pw = None
while not pw:
pw = input("What is your apps passphrase? ")
vault_apps[app]=pw
def print_vault():
print("Vault content:")
for key,value in vault_apps.items():
print(f" {key:<10}\t==>\t{value}")
def find_password():
if vault_apps:
pass
else:
print("nothing in your password store")
def main():
k = None
print('You have opened the locker,\nPlease select what you would like to do.')
while True:
choice = menu()
if choice == 1:
find_password()
elif choice == 2:
input_new_app()
k = input("Would you like to add another app and password?").lower()
while k in {"yes","y"}:
input_new_app()
elif choice == 3:
print_vault()
elif choice == 4:
print("Good bye")
break
main()
Output:
You have opened the locker,
Please select what you would like to do.
----------------------------------------
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully
----------------------------------------
Choose: 1
nothing in your password store
----------------------------------------
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully
----------------------------------------
Choose: 2
What is your apps name? A
What is your apps passphrase? 66
Would you like to add another app and password? n
----------------------------------------
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully
----------------------------------------
Choose: 3
Vault content:
A ==> 66
----------------------------------------
1) find your existing passwords
2) save a new password for your apps
3) see a summary of your password locker
4) exit password locker successfully
----------------------------------------
Choose: 4
Good bye

This logic is flawed.
Once you enter the infinite while loop, you have no way to exit it, other than to enter "no". When you enter "yes", the value of locker_menu_var changes, but you donot exit the loop, so it keeps repeating the same menu.
while True:
ask_again = input('''Would you like to add another app and password?
''')
if ask_again.lower() == "yes":
locker_menu_var = "2"
elif ask_again.lower() == "no":
locker_menu_func()
You are mixing the looping and recursion, which is making things confusing. One simple way to do this is:
vault_apps = []
def locker_menu():
# the entry message
msg = '''You have opened the locker, Please select what you would like to do,'''
print(msg, end="\n\n")
# nume options
menu = ["1) find your existing passwords",
"2) save a new password for your apps",
"3) see a summary of your password locker",
"4) exit password locker successfully"]
menu_string = f"Press:\n{menu[0]}\n{menu[1]}\n{menu[2]}\n{menu[3]}\n"
# now enter the loop
while True:
# input variable
# NOTE: This variable is inside the loop,
# so that the user can enter the value everytime
# the loop repeates.
locker_menu_var = input(menu_string)
if locker_menu_var == "1":
# retrieve password for an existing record.
# although it's not a good idea to just print
# all the records, I am not changing your application logic
# because I don't see any use in it.
# you missed one case in your logic,
# which I have fixed here.
if len(vault_apps) == 0:
print("you have nothing stored")
else:
print(vault_apps)
elif locker_menu_var == "2":
# for a new entry
# enter your logic here
an = input("app name: ")
passw = input("password: ")
vault_apps.append([an, passw])
done = False # flag for exiting
while not done:
inp = input("enter another?")
if inp == "yes":
# enter logic here
an = input("app name: ")
passw = input("password: ")
vault_apps.append([an, passw])
else:
done = True
elif locker_menu_var == "3":
# do something
pass
elif locker_menu_var == "4":
return
if __name__ == "__main__":
locker_menu()

Related

For some reason my python code is skipping a certain part of code (pygame)

Loging in with jack works fine but I cant login with jake even thought he exists in the array. It just skips the whole for loop "for i in storedusername". An help would be grateful.
Here's the code:
import pygame
import sys
import random
storedusername = ["jack","jack","jack","jake","jack","jack","jack",] # The place where the username is stored
storedpass = ["abcde","abcde","abcde","12345","abcde","abcde","abcde",] # The current place where the password is stored
Login = False
def login(): # Function used to login
global Login # Global the logins fucntion
Login = False # Sets Login to false
user = input("Enter Username: ") # User enters the username that they would like to login with
print(user)
for i in storedusername: # Loops through the items in the list
if i == user: # Compares the items in the list with the username that the user has entered
print("user found") # If the user was found then the program will tell the user that
pos = int(storedusername.index(user)) # Finds the position where the username is stored
print(pos)
for j in range(0,10): # Has 10 tries to do this loop
password = input("Enter Password: ") # The user enters the password which they think matches with the username.
#for i in range(0,10):
if password == storedpass[pos]: # Goes to the position where the password matches the username is stored and compares the values.
print("password match username") # Program returns if the username and password match
Login = True # Turns login to True
return Login # Returnes Login
break
else:
print("Pasword does not match try again") # If the password does not match then the program will notify it.
print("too many attempts close the program") # If there are too many attempts than it will close.
else:
print("not found") # If the username is not found than it will be promted that it is not found.
return Login # Returns login.
login()
You are using the variable i both for outer and inner loop, so it is changed inside.
It must be:
for i in ... :
...
for j in ... :
...
You were right to think that the indentation wasn't correct. As you had it before, if you entered a username not present in the list, you would still be asked for the password ten times for each user in storedusername (a total of 70 times!). Moving the block from for i in range(0,10) one indentation further fixes it.
for i in storedusername: ############ It skips this loop
if i == user:
print("user found")
pos = int(storedusername.index(user))
print(pos) ########### All the way up to here
# >>>> indent here
for i in range(0,10): # Has 10 tries to do this loop
password = input("Enter Password: ") # The user enters the password which they think matches with the username.
#for i in range(0,10):
if password == storedpass[pos]: # Goes to the position where the password matches the username is stored and compares the values.
print("password match username") # Program returns if the username and password match
Login = True # Turns login to True
return Login # Returnes Login
break
else:
print("Pasword does not match try again") # If the password does not match then the program will notify it.
# >>>>>
print("too many attempts close the program") # If there are too many attempts than it will close.
else:
print("not found") # If the username is not found than it will be promted that it is not found.
You may see that not working because of wrong indentation of that
else:
print(
"Pasword does not match try again") # If the password does not match then the program will notify it.
print(
"too many attempts close the program") # If there are too many attempts than it will close.
block.
Please move it to to left, and it should be better.
That modified version
storedusername = ["jack", "jack", "jack", "jake", "jack", "jack",
"jack", ] # The place where the username is stored
storedpass = ["abcde", "abcde", "abcde", "12345", "abcde", "abcde",
"abcde", ] # The current place where the password is stored
(width, height) = (644, 412)
Login = False
def login(): # Function used to login
global Login # Global the logins fucntion
Login = False # Sets Login to false
user = input(
"Enter Username: ") # User enters the username that they would like to login with
print(user)
for i in storedusername: ############ It skips this loop
if i == user:
print("user found")
pos = int(storedusername.index(user))
print(pos) ########### All the way up to here
for i in range(0, 10): # Has 10 tries to do this loop
password = input(
"Enter Password: ") # The user enters the password which they think matches with the username.
# for i in range(0,10):
if password == storedpass[
pos]: # Goes to the position where the password matches the username is stored and compares the values.
print(
"password match username") # Program returns if the username and password match
Login = True # Turns login to True
return Login # Returnes Login
break
# --> wrong indentation
else:
print(
"Pasword does not match try again") # If the password does not match then the program will notify it.
print(
"too many attempts close the program") # If there are too many attempts than it will close.
# <-- wrong indentation
else:
print(
"not found") # If the username is not found than it will be promted that it is not found.
return Login # Returns login.
# register()
login()
allows for
Enter Username: jack
jack
user found
0
Enter Password: abde
Pasword does not match try again
Enter Password: abcde
password match username
Process finished with exit code 0
I'm not going to modify the flow of your solution, but I'd suggest to write comments before the line, not in it. Also you should avoid variables shadowing (using the same variable like i in different scopes). The last thing is that you got slightly wrong indent for password checking - it was run even wihtout matched name. I allowed myself to propose version with all these modifiactions. Please take a look on that:
def login():
""" Function used to login"""
# Global the logins fucntion
global Login
Login = False
# User enters the username that they would like to login with
user = input("Enter Username: ")
print(user)
for stored_user_name in stored_user_names:
if stored_user_name == user:
print("user found")
pos = int(stored_user_names.index(user))
# Has 10 tries to do this loop
for try_attempt in range(0, 10):
# The user enters the password which they think matches with the username.
password = input("Enter Password: ")
# Goes to the position where the password matches the username is stored and compares the values.
if password == storedpasswords[pos]:
# Program returns if the username and password match
print("password match username")
Login = True # Turns login to True
return Login # Returnss Login
else:
# If the password does not match then the program will notify it.
print("Password does not match try again")
# If there are too many attempts than it will close.
print("too many attempts close the program")
else:
# If the username is not found than it will be promted that it is not found.
print("not found")
return Login

Python: Being asked for input twice and outputting duplicate print statements

I am trying to finish off my program my adding a menu that allows the user to select a few options that allow the user to store website names and passwords in lists. But there was a problem as soon as I have appended some website names and passwords into their respective vaults where whenn I try to select an option after appending the website names and passwords, "1" for example is the expected input to call the viewapp() function to see the websites and passwords stored so far. The thing is it takes more than twice to call the viewapp() function, where it rejects the first expected input but accepts the 2nd one strangely. Also when I select the 3rd option for the purpose to call summary(), the whole printed summary would print out twice, which is a similar pattern to the menu only accepting the 2nd expected input. The program is doing what I want except for this annoying bug where selecting those four options makes it ask for input a second time when it's supposed to straight away jump to that function. Help would be appreciated.
appvault = []
passvault = []
def logged():
print("----------------------------------------------------------------------\n")
print("Hello, welcome to the password vault console. ")
modea = input("""Below are the options you can choose from in the password vault console:
##########################################################################\n
1) Find the password for an existing webiste/app
2) Add a new website/app and a new password for it
3) Summary of the password vault
4) Exit
##########################################################################\n
> """).strip()
return modea
def viewapp():
if len(appvault) > 0:
for app in appvault:
print("Here is the website/app you have stored:")
print("- {}\n".format(app))
if len(passvault) > 0 :
for code in passvault:
print("Here is the password you have stored for the website/app: ")
print("- {}\n".format(code))
else:
print("You have no apps or passwords entered yet!")
def addapp():
while True:
validapp = True
while validapp:
new_app = input("Enter the new website/app name: ").strip().lower()
if len(new_app) > 20:
print("Please enter a new website/app name no more than 20 characters: ")
elif len(new_app) < 1:
print("Please enter a valid new website/app name: ")
else:
validapp = False
appvault.append(new_app)
validnewpass = True
while validnewpass:
new_pass = input("Enter a new password to be stored in the passsword vault: ")
if not new_pass.isalnum():
print("Your password for the website/app cannot be null, contain spaces or contain symbols \n")
elif len(new_pass) < 8:
print("Your new password must be at least 8 characters long: ")
elif len(new_pass) > 20:
print("Your new password cannot be over 20 characters long: ")
else:
validnewpass = False
passvault.append(new_pass)
validquit = True
while validquit:
quit = input("\nEnter 'end' to exit or any key to continue to add more website/app names and passwords for them: \n> ")
if quit in ["end", "End", "END"]:
logged()
else:
validquit = False
addapp()
return addapp
def summary():
if len(passvault) > 0:
for passw in passvault:
print("----------------------------------------------------------------------")
print("Here is a summary of the passwords stored in the password vault:\n")
print("The number of passwords stored:", len(passvault))
print("Passwords with the longest characters: ", max(new_pass for (new_pass) in passvault))
print("Passwords with the shortest charactrs: ", min(new_pass for (new_pass) in passvault))
print("----------------------------------------------------------------------")
else:
print("You have no passwords entered yet!")
while True:
chosen_option = logged()
print(chosen_option)
if chosen_option == "1":
viewapp()
elif chosen_option == "2":
addapp()
elif chosen_option == "3":
summary()
elif chosen_option == "4":
break
else:
print("That was not a valid option, please try again: ")
print("Goodbye")
This happens because you call logged() when exiting addapp():
if quit in ["end", "End", "END"]:
logged()
Then, the choice you enter is returned by logged(), and thrown away as it isn't assigned to anything.
You're now back at the end of the previous block in addapp(), and the next instruction is return addapp, that will bring you back to your main loop, where you'll be sent to logged() again by chosen_option = logged()
Note that in return addapp, you return the addapp function itself, which is certainly not what you want to do. So, as you don't need a return value for addapp(), just use return, or nothing at all, Python will automatically return at the end of the function.
So, to solve your problem: directly return when you're done entering sites:
if quit in ["end", "End", "END"]:
return
Note also that you recursively call addapp() from itself when you add more sites.
You should generaly avoid that unless you really want to use some recursive algorithm, and rather use a loop as you did in your main loop. By default, Python limits you to 1000 recursion levels - so you could even crash your app by entering more than 1000 sites in a row ;)
The summary problem is only caused by the unnecessary for loop in summary()
You are nearly there. The issue is in the addapp() function at line 63:
if quit not in ["end", "End", "END"]:
logged()
if you replace
logged()
with
pass
Then everything will work a ok.
You are not handling the result of the logged function here anyway.
You also do not need to process the logged function here. The addapp will exit and the logged function will be called and handled in the while loop the addapp function was called from.

Python User Registration

I am trying to make a working user registration program. When asked for the username, the system will look to see if the text entered has already been stored. If the username has already been stored, it will ask for the password for that user. However, if the username has not been stored, it will ask for a password. When these are entered, the script will then appendix onto a .txt of a .py file to make an new account. After the account has been made, the script can then read the .txt or .py file for the login information. My current login code:
loop = "true"
while(loop == "true"):
username = input("Enter Username: ")
password = input("Enter Password: ")
h = input ("Do You Need Help [Y/N]: ")
if(h == "Y" or h == "y" or h == "yes" or h == "Yes"):
print ("Enter username and password to login. If you do not have an account yet, enter 'Guest' as the username and press enter when it asks for the password.")
elif(h == "N" or h == "n" or h == "no" or h == "No"):
print (" >> ")
if(username == "Hello World" and password == "Hello World" or username == "Test User" and password == "Test User" or username == "Guest"):
print ("Logged in Successfully as " + username)
if(username == "Guest"):
print ("Account Status: Online | Guest User")
if not (username == "Guest"):
print ("Account Status: Online | Standard User")
How do you make a database that python can read from for the username and password? Also, how do you make it so that python can appendix to the database to add more usernames and passwords?
This is Python v3.3.0 Mac OSX 10.8
Thank you in advance!
Try using the pickle module:
>>> import pickle
>>> myusername = "Hello"
>>> mypassword = "World"
>>> login = [myusername, mypassword]
>>> pickle.dump(login, open("%s.p" % login[0], "wb")) #Saves credentials in Hello.p, because Hello is the username
>>> #Exit
Now to get it back
>>> import pickle
>>> try:
... password = pickle.load(open("Hello.p", "rb"))[1]
... username = pickle.load(open("Hello.p", "rb"))[0]
... except IndexError: #Sees if the password is not there
... print("There is no information for those credentials")
...
>>> password
'mypassword'
>>> username
'myusername'
If there is no password or username, it prints There is no information for those credentials... Hope this helps!
AND JUST A TIP: don't bother going through if(h == 'n'..., just do a h.lower().startswith("n") == True. .lower() makes everything lowercase, and str.startswith("n") checks if str starts with the letter n.

Adding new users/passwords to dictionary in python email application

I'm having a bit of trouble with this program I've been working on for part of the final for my ITP 100 class. It's supposed to be an email application where you can log in if you are an existing user, or create a new username and password. I'm able to log into existing users with their passwords, and I can create a new username, but when I try to create the new password for it, I keep getting errors. I'm sure it's because I'm not updating the dictionary properly. I'm still pretty new to Python, so hopefully this all makes sense. Any advice?
Also, my program seems to be stuck in an "if loop..?". Whenever I successfully log into an existing user, it show that I've been logged in, but will also go back to the original question "Are you a registered user? y/n? Press q to quit"
Any help is greatly appreciated. Thank you.
import re
users = {}
users={"nkk202": "konrad", "jfk101": "frederick"}
choice = None
login = None
createPassword = None
createUser = None
createLogin = None
print("Welcome to Kmail. The most trusted name in electronic mail.")
print("\nLet's get started")
while choice != "q":
choice = input("Are you a registered user? y/n? Press q to quit: ")
if choice == "q":
print("Thank you for using Kmail. Goodbye.")
if choice == "n":
print("Okay then, let's set up an account for you then.")
createUser = input("Create login name: ")
if createUser in users:
print("I'm sorry, that username is already in use. Please try another!\n")
else:
createPassword = input("Enter a password: ")
if len(createPassword) <5:
print("I'm sorry, this password is too short. Please try another.")
passValue = {1:'Weak', 2:'Good', 3:'Excellent'}
passStrength = dict.fromkeys(['has_upper', 'has_lower', 'has_num'], False)
if re.search(r'[A-Z]', createPassword):
passStrength['has_upper'] = True
if re.search(r'[a-z]', createPassword):
passStrength['has_lower'] = True
if re.search(r'[0-9]', createPassword):
passStrength['has_num'] = True
value = len([b for b in passStrength.values() if b])
print ('Password is %s' % passValue[value])
users.update((createUser, createPassword))
elif choice == "y":
login = input("Enter your username: ")
if login in users:
password = input("Enter your password: ")
if users[login] == password:
print("Welcome", login, "!")
else:
print
print("I'm sorry, either the password/username was unaccaptable, or does not exist. Please try again. \n")
Seems like you just want
users[createUser] = createPassword

Simple username and password application in Python

I'm trying to build a simple login and password application using a dictionary. It works fine except the part where it checks if the login matches the password (in the bottom where it says "Login successful!").
If I were to create login 'a' and password 'b', and then create login 'b' and password 'a', it would log me in if I tried to log in with login 'a' and password 'a'. It just checks if those characters exist somewhere in the dictionary, but not if they are a pair.
Any suggestions how to fix this?
users = {}
status = ""
while status != "q":
status = raw_input("Are you a registered user? y/n? Press q to quit: ")
if status == "n": #create new login
createLogin = raw_input("Create login name: ")
if createLogin in users: # check if login name exist in the dictionary
print "Login name already exist!\n"
else:
createPassw = raw_input("Create password: ")
users[createLogin] = createPassw # add login and password
print("\nUser created!\n")
elif status == "y": #login the user
login = raw_input("Enter login name: ")
if login in users:
passw = raw_input("Enter password: ")
print
if login in users and passw in users: # login matches password
print "Login successful!\n"
else:
print
print("User doesn't exist!\n")
Edit
Now that this is working, I'm trying to divide the application to three functions, for readability purposes. It works, except that I get infinite loop.
Any suggestions why?
users = {}
status = ""
def displayMenu():
status = raw_input("Are you a registered user? y/n? Press q to quit: ")
if status == "y":
oldUser()
elif status == "n":
newUser()
def newUser():
createLogin = raw_input("Create login name: ")
if createLogin in users: # check if login name exists
print "\nLogin name already exist!\n"
else:
createPassw = raw_input("Create password: ")
users[createLogin] = createPassw # add login and password
print("\nUser created!\n")
def oldUser():
login = raw_input("Enter login name: ")
passw = raw_input("Enter password: ")
# check if user exists and login matches password
if login in users and users[login] == passw:
print "\nLogin successful!\n"
else:
print "\nUser doesn't exist or wrong password!\n"
while status != "q":
displayMenu()
Right now you are checking if the given password, passw, matches any keys in users (not right). You need to see if the password entered matches that particular user's password. Since you have already checked if the username exists in the dictionary's keys you don't have to check again, so try something like:
if passw == users[login]:
print "Login successful!\n"
EDIT:
For your updated code, I'm going to assume by "infinite loop" you mean that you cannot use q to exit the program. It's because when you're inside displayMenu, you save user input in a local variable named status. This local variable does not refer to the same status where you are checking,
while status != "q":
In other words, you are using the variable status in two different scopes (changing the inner scope does not change the outer).
There are many ways to fix this, one of which would be changing,
while status != "q":
status = displayMenu()
And adding a return statement at the end of displayMenu like so,
return status
By doing this, you are saving the new value of status from local scope of displayMenu to global scope of your script so that the while loop can work properly.
Another way would be to add this line to the beginning of displayMenu,
global status
This tells Python that status within displayMenu refers to the global scoped status variable and not a new local scoped one.
change
if login in users and passw in users: # login matches password
to
if users[login] == passw: # login matches password
Besides, you should not tell the hackers that "User doesn't exist!". A better solution is to tell a generall reason like: "User doesn't exist or password error!"
Please encrypt you passwords in database if you go put this online.
Good work.
import md5
import sys
# i already made an md5 hash of the password: PASSWORD
password = "319f4d26e3c536b5dd871bb2c52e3178"
def checkPassword():
for key in range(3):
#get the key
p = raw_input("Enter the password >>")
#make an md5 object
mdpass = md5.new(p)
#hexdigest returns a string of the encrypted password
if mdpass.hexdigest() == password:
#password correct
return True
else:
print 'wrong password, try again'
print 'you have failed'
return False
def main():
if checkPassword():
print "Your in"
#continue to do stuff
else:
sys.exit()
if __name__ == '__main__':
main()
usrname = raw_input('username : ')
if usrname == 'username' :
print 'Now type password '
else :
print 'please try another user name .this user name is incorrect'
pasword = raw_input ('password : ')
if pasword == 'password' :
print ' accesses granted '
print ' accesses granted '
print ' accesses granted '
print ' accesses granted '
print 'this service is temporarily unavailable'
else :
print 'INTRUDER ALERT !!!!' , 'SYSTEM LOCKED'
print 'INTRUDER ALERT !!!!' , 'SYSTEM LOCKED'
print 'INTRUDER ALERT !!!!' , 'SYSTEM LOCKED'
exit()
This is a very simple one based on the one earlier for a single user with improved grammar and bug fixes:
print("Steam Security Software ©")
print("-------------------------")
print("<<<<<<<<<Welcome>>>>>>>>>")
username = input("Username:")
if username == "username" :
print ("Now type password")
else :
print ("please try another user name. This user name is incorrect")
password = input ("Password:")
if password == "password" :
print ("ACCESS GRANTED")
print ("<<Welcome Admin>>")
#continue for thins like opening webpages or hidden files for access
else :
print ("INTRUDER ALERT !!!!" , "SYSTEM LOCKED")
exit()

Categories

Resources