67. Python Program to Check a Username and Password
MediumNested if
Overview
A second question only when the first answer is yes.
Problem Statement
The correct username is sunny and the password is py123. Read a username, then a password. Print Welcome! if both are right, Wrong password if only the username is right, and Unknown user otherwise. For example, for sunny and py123:
Welcome!
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One value per line, in this order. Example:
sunny
py123
Output
The output for that example:
Welcome!
The tests try 3 different inputs.