Knowee
Questions
Features
Study Tools

Write a python program to accept the username "Admin" asthe default argument and password 123 entered by the user toallow login into the system using function

Question

Write a Python program to accept the username "Admin" as the default argument and password 123 entered by the user to allow login into the system using function.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a simple Python program that uses a function to accept a username and password for login. The username has a default value of "Admin".

def login_system(username="Admin", password=None):
    if password is None:
        password = input("Please enter your password: ")
    if username == "Admin" and password == "123":
        print("Login successful!")
    else:
        print("Invalid username or password. Please try again.")

# Call the function
login_system(password="123")

In this program, the login_system function accepts two parameters: username and password. The username has a default value of "Admin". If no password is provided when the function is called, the program will prompt the user to enter a password. The function then checks if the username is "Admin" and the password is "123". If both are correct, it prints "Login successful!". Otherwise, it prints "Invalid username or password. Please try again."

This problem has been solved

Similar Questions

What is wrong with the following code?for username in failed_login:print(username)

Write a python script that accept a number from the user and display a prime number from 1 to the value:

Select the correct answerWhat will be the output of the following Python code?def ct(y): global y y+=2 print(y)ct(5)print("hi")Optionserror77hihi

Write the output of the program below. age = 45if (age >= 35): {print ("I am Qualified")}

When a Python function is called, inside the function, the arguments are assigned to variables called parameters.Question 8Select one:TrueFalse

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.