- Get link
- X
- Other Apps
Simple Password System in Python
Hello Programmers,
In this tutorial, I will teach you how to make a password system using Python. This is an intermediate project in python. If you have any confusion then you can comment below. So, let's get started.
The whole code:
while(True):
password = input("Password:")
if(password == "Pass123"):
print("Hello")
exit()
else:
print("False")
Step-1: Create a Python file
First of all, create a python file.
Step-2: Make an infinite loop
while(True):
In the ablove code, we are making an infinite loop. Because the password system will go on forever until the right password is given.
Step-3: Taking input from the user
while(True):
password = input("Password:")
In the above code, we are taking the password from the user and storing it in the password variable.
Step-4: Adding conditional logic
if(password == "Pass123"):
print("Accesss Granted!")
exit()
else:
print("Wrong Password! Try again")
In the above code, we are comparing the given password with the correct password. If the user has given the correct password then it will print "Access Granted". And if the password is wrong then it will print "Wrong password! Try again". When the user will give the correct password then the program will exit using the built-in function exit(). You can place your code in the if block. You can call a function or do something else.
if(password == "Pass123"):
The "Pass123" is the correct password. You can change it to your choice of password.
Congratulations! Now you know how to make a simple password system in python. I think it will help you in future projects. Still, if you have any confusion, then you can comment below. Bye for now ;)
Happy Coding :)
python, password, how to make a login system in python, make a simple login system in python, how to make a login system using tkinter in python, how to make a username and password on python, how to make a gui based python login system, make a login system in python hindi, how to create a login system in python, make a login system in python in hindi, python tutorial, python coding a password system, how to make projects in python, how to create a login system in python using a text file
Comments
Post a Comment