Username & Password Authentication System Using Python

Shivam Vatshayan
1 min readApr 3, 2022

--

Photo by Mourizal Zativa on Unsplash

Password authentication system is a system that is used for the identification of a user

To create a password authentication system using Python use these approaches:

import getpassdatabase = {"Onkar": "123456", "Modi": "654321"}username = input("Enter Your Username : ")password = getpass.getpass("Enter Your Password : ")for i in database.keys():if username == i:while password != database.get(i):password = getpass.getpass("Enter Your Password Again : ")breakprint("Verified")

Another Way :

count = 0while True:userName = input("Hello! Welcome to FaceSnap! \n\nUsername: ")password = input("Password: ")count += 1if count == 1:#tells user byebreak #exitelse:if userName == 'Modiji' and password == '123456':#let them inprint("You are Good to go!")break #they are in, exit loopelse:print("Wrong! Try Again!");

Another Way:

attempts=0while attempts<1:username=input('username?')password=input('password?')if username=='Onkar'and password=='12345':print('you are in!')else:attempts+=1print('incorrect!')if attempts==1:print('too many attempts')

Hi there :)

Any Queries/Ned help ?

Mail : vatshayan007@gmail.com

--

--

Shivam Vatshayan
Shivam Vatshayan

Written by Shivam Vatshayan

Blockchain Developer || Project Developer || Software Engineer

No responses yet