Question

in python

5.23 Login Create a program that prompts the user for a username and password. The correct username should be python and the

0 0
Add a comment Improve this question Transcribed image text
Answer #1

According to the problem below is the sample code is written in python 3:

if __name__== "__main__":
    print ("Welcome to my secret program!")
    count = 0

    while count < 4:
        if count < 3:
            print("\n")
            username = input("Please enter your username : ")
            password = input("Please enter your password : ")
            if username == "python" and password == "csci135":
                print("\n")
                print("Thanks for entering the correct username and password! ")
                print("I hope you have a GREAT day!!")
                break
            else:
                if username != "python" and password != "csci135":
                    print("Invalid username and password")
                    count += 1
                elif username != "python" and password == "csci135":
                    print("Invalid user name")
                    count += 1
                elif username == "python" and password != "csci135":
                    print("Invalid password")
                    count += 1
        else:
            print("\n")
            print ("Too many attempts! You are locked out!")
            break

100% sample_outp.... if _name main: print (Welcome to my sec ret program!) count 0 sample... 80% L while count< 4 if coun

Add a comment
Know the answer?
Add Answer to:
in python 5.23 Login Create a program that prompts the user for a username and password....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lab: User login system (python) Create a user login system. Your code should do the following:...

    Lab: User login system (python) Create a user login system. Your code should do the following: 1.Load your user database from “UD.txt” (USE THE EXACT FILE NAME, file is given in the folder) 2.Display “Login or create a new user? Select L to login, select C to create new user.” 3. If wrong selection is entered, take the user back to step 2. 4. If the user entered “L”, display “Please enter your user name and hit enter” 5. Check...

  • 1. Create a program to verify a user name and password given by a user 2....

    1. Create a program to verify a user name and password given by a user 2. Create a text file named "correctData.txt" (You will NOT upload this file during submission). Place a username on line 1 in the txt file and a password on line 2 in the file. This will be used for testing. 3. Create the following functions and call them starting from main: • void login () - This function is responsible for displaying the prompts asking...

  • Write an infinite while loop that asks the user for their username and password. The loop...

    Write an infinite while loop that asks the user for their username and password. The loop only stops if the username and password for the user are correct. There are only 2 users: the first user’s username is user123 and their respective password is passwrd1, the second user’s username is user234 and their respective password is passwrd2. Expected output/input when loop is to stop: Enter username: user123 Enter password: passwrd1 Welcome user123 !Expected output/input when loop continues:Enter username: user234 Enter...

  • Write a C++ program to allow an user to enter username and password, and then compare...

    Write a C++ program to allow an user to enter username and password, and then compare the entered values with the values which stored in a file called login.txt. Display an message "Login successful" if the values are matched, otherwise display "Login fail!. This program allow the user to have three times of tries, if exceeded the number of times, display a message "Number of times is exceeded, please contact administrator (Assume, the stored username is "INTI-IU and password is...

  • Write a code using python that simulates a Registration of a Username and Password with the...

    Write a code using python that simulates a Registration of a Username and Password with the following conditions the user can set its username display "Input username" input Username display "Input Password" input Password The password must be at least 5 characters and no longer than 10 characters if the password doesn't follow this instructions Display "Can't accept this password" once the password its stored Verify that the program works by Testing it input username Input Password The user has...

  • Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user...

    Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...

  • in java Complete Program that simulates a login procedure. The program reads a list of names,...

    in java Complete Program that simulates a login procedure. The program reads a list of names, email addresses and passwords from a file p3.txt. Store the information in parallel array lists names, emails and passwords. Your program will prompt the user for their email address. If the email is not in the system, prompt the user to try again. Provide the option to quit. If the email is found in the system, prompt the user to enter their password. After...

  • ATM MACHINE

    Kindly help me In this assignment you will create a RMI based system that allows a user to do the following: 1) Create a bank account by supplying a user id and password. 2) Login using their id and password. 3) Quit the program. Main Manu of ATM service window *Separate remote methods will be created for all of these functionalities. ->To create account see output below Hi! Welcome to  ATM Machine! Please select an option from the menu below: l -> Loginc -> Create New Account q -> Quit > c...

  • Can anyone help me with rewriting my pseudocode? Below is the pseudocode, and after that is...

    Can anyone help me with rewriting my pseudocode? Below is the pseudocode, and after that is the completed program. Pseudocode: DISPLAY Login information PROMPT for username/password            output "Enter Username"            input userName          output "Enter password: "         input password //If successful, display information pertaining to the specific user, as well as prompt for logout    IF User type 'quit'      Exit Program    VALIDATE User Credentials   IF NOT Validated      Check number of Invalid Attempts         IF user attempts equal three THEN            DISPLAY error message...

  • Can someone fix the program below so it does what the picture says it won't work...

    Can someone fix the program below so it does what the picture says it won't work for me. import java.util.Scanner; public class Userpass { static String arr[]; static int i = 0; public static void main(String[] args) { String username, password; int tries = 0, result; do { System.out.print("Enter the username: "); username = readUserInput(); System.out.print("Enter the password: "); password = readUserInput(); result = verifyCredentials(username, password); tries++; if (result == -1) System.out.println("The username is incorrect!\n"); else if (result == -2)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT