This is my code for Verifying User ID and password from a csv file.
CODE
import pandas as pd
login():
df=pd.read_csv("IDPASS.csv")
for i in range(len(df)):
x=input("Enter User Name=")
y=input("ENter The Password=")
if (df.iloc[i]["ID"])==x:
if str(df.iloc[i]["PASS"])==y:
print("Succesfully Logined")
break
else:
print("Invalid Password")
print("Try Again!!")
else:
print("Invalid Username")
print("Try Again!!")
login()
Output1:
Enter User Name=JEET1073
ENter The Password=str1234
Succesfully Logined
Here I have entered correct id password and the code is executed perfectly!!
Output2:
Enter User Name=dw
ENter The Password=wd
Invalid Username
Try Again!!
Enter User Name=JEET1073
ENter The Password=str1234
Invalid Username
Try Again!!
Enter User Name=JEET1073
ENter The Password=str1234
Invalid Username
Try Again!!
Enter User Name=JEET1073
ENter The Password=str1234
Invalid Username
Try Again!!
Enter User Name=JEET1073
ENter The Password=str1234
Invalid Username
Try Again!!
Here at first i have entered wrong id and password and then i was trying to enter the correct id and password but it was showing invalid username. any solutions will be appreciated,also i want a solution in which if a user enters wrong id password the code should run again asking id and password till the user id and password entered is not correct.Thanks in advance.