Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Program Name: simpleLogin.py
- Created By: Majin Goten
- Program Description:
- Simple login to a simple database of simpleness
- """
- def main(): # Main Program
- userName = "JohnDoe123" # Change this to any username
- passWord = "password123" # Change this to any password
- while True: # Loops until correct username entered
- nameEntered = input("Username: ") # Asks for username from user
- try: # Executes code inside successfully, if no errors found
- # Compares user input with actual username
- if nameEntered.lower() == userName.lower():
- # Exits loop if username is correct
- break
- else:
- # Prints error message if wrong username
- print("\nSorry", nameEntered,"does not exist in the database!\n")
- except:
- # Print error message if the above code fails
- print("\nInvalid Input, try again!\n")
- # Tell user to enter password
- print("\nEnter the password for",nameEntered,"below")
- while True: # Loops until correct password entered
- passEntered = input("Password: ") # Asks for password from user
- try: # Executes code inside successfully, if no errors found
- # Compares user input with actual password
- if passEntered.lower() == passWord.lower():
- # Exits loop if password is correct
- break
- else:
- # Prints error message if wrong password
- print("\nSorry, incorrect password, please try again!\n")
- except:
- # Prints error message if the above code fails
- print("\nInvalid Input, try again!\n")
- print("Welcome",userName+"!") # Prints welcome message
- main() # Call to main()
Add Comment
Please, Sign In to add comment