Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Username and Password Login Function

def login():
    attempt = 3
    username = input("Enter your username:
> ")
    while True:
     if username in userNamePassword:
        password = input("Enter your password:
> ")
        if userNamePassword[username] == password:
            print("Logged in")
            return True
        elif userNamePassword[username] != password:
            attempt -=1
            print("Sorry, the password is invalid. You have", attempt,"attempts remaining.")  
            login()
            if attempt == 0:
             print("Sorry, you have exhausted your password attempts. Please restart the process.")
             break
Comment

PREVIOUS NEXT
Code Example
Python :: bouon arrondi tkinter 
Python :: Constructing a Class with __init__ function 
Python :: gwt height with tkinker 
Python :: how to add 2 integers in python 
Python :: form is undefined flask 
Python :: non preemptive priority scheduling in c# 
Python :: discord.py custom status 
Python :: python check column conditions 
Python :: Free the Bunny Prisoners 
Python :: rectangle function numpy 
Python :: vscode how to extend output size in jupyter notebook 
Python :: how to export schema in graphene django 
Python :: float python precision 
Python :: grading system in python with nested if 
Python :: python capitilize 
Python :: get multiples of a number between two numbers python 
Python :: print a box like the ones below 
Python :: leetcode 206 python 
Python :: File "main.py", line 11 if message.author == client.user: ^ IndentationError: expected an indented block 
Python :: check labels with handles in ax 
Python :: Cget subassembly civid3d 
Python :: p and c in python 
Python :: qcut and cut function in python stack overflow 
Python :: python reverse words and swap case 
Python :: sns countplot show only largest 
Python :: datetime german format python 
Python :: modbusfc03 python 
Python :: tkl to pkr 
Python :: what does << do in python 
Python :: length of a list python 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =