DEV Community

Bikram Singh
Bikram Singh

Posted on

Login python code

sorry for the code problem in this website
Heres the code:

The correct username is Hohima and the correct Password is Hohima1234 and the valid name is Hohima2nd

the info is give over here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

userName = input("Hello! Welcome to Twinklebot! \n\nUsername:") #Ask's the User for Username input
password = input("Password:") # Ask's the user for their password

count = 0 # Create a variable, to ensure the user has limited attempts at entering their correct username and password
count += 1 # The user has already had one attempt above, therefore count has been incremented by 1 already.

while userName == userName and password == password: # The Input will always lead to this while loop, so we can see if their username and password is wrong or correct.

if count == 3: # Counter, to make sure the user only gets a limited number (3)of attempts
    print("\nThree Username and Password Attempts used. Goodbye") # Lets the user know they have reached their limit
    break # Leave the Loop and the whole program


elif userName == 'Hohima' and password == 'Hohima1234': # The userName and password is equal to 'elmo' and 'blue', which is correct, they can enter FaceSnap!
    Input_passwrd = input("Enter your valid name:")
    if Input_passwrd == 'Hohima2nd':
        print("\nHeres your safe data")
    elif Input_passwrd != 'Hohima2nd':
        print("Your safe name is wrong")
    break


elif userName != 'Hohima' and password != 'Hohima1234': # The userName and password is NOT equal to 'elmo' and 'blue', the user cannot enter FaceSnap
    print("Your Username and Password is wrong!") # Lets the user know that the Username and password entered is wrong.
    userName = input("\n\nUsername:") # Requests the user to have another attempt at entering their correct username
    password = input("Password:") # Requests the user to have another attempt at entering their correct password
    count += 1 # Increments the count by 1
    continue # Continue, as the user hasn't managed to get their username and password correct yet


elif userName == 'Hohima' and password != 'Hohima1234': # The userName is equal to 'elmo', but password is NOT equal to 'blue', the user cannot enter FaceSnap
    print("Your Password is wrong!") # Lets the user know that their password is wrong
    userName = input("\n\nUsername:") # Requests the user to have another attempt at entering their correct username
    password = input("Password:") # Requests the user to have another attempt at entering their correct password
    count += 1 # increments the count by 1
    continue # Continue, as the user hasn't managed to get their username and password correct yet


elif userName != 'Hohima' and password == 'Hohima1234': # The userName is NOT equal to 'elmo', however password is equal to 'blue', the user cannot enter FaceSnap
    print("Your Username is wrong!") # Lets the user know that their username is wrong
    userName = input("\n\nUsername:") # Requests the user to have another attempt at entering their correct username
    password = input("Password:") # Requests the user to have another attempt at entering their correct password
    count += 1 # Increments the count by 1
    continue # Continue, as the user hasn't managed to get their username and password correct yet
Enter fullscreen mode Exit fullscreen mode

Top comments (0)