English

Write a program to input username and password and to check whether the given username and password are correct or not.

Advertisements
Advertisements

Question

Write a program to input username and password and to check whether the given username and password are correct or not.

Code Writing
Advertisements

Solution

Compare the entered username and password with the valid username and password.

username = input("Enter username: ")
password = input("Enter password: ")

if username == "admin" and password == "admin123":
    print("Username and password are correct")
else:
    print("Username or password is incorrect")
shaalaa.com
  Is there an error in this question or solution?
Chapter 1: Review of Phython - EXERCISE [Page 27]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 1 Review of Phython
EXERCISE | Q 22. | Page 27
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×