Previous

If-Else Statements

3 / 6
Next

To check that two conditions are simultaneously true, we use the Python and operation.

password = input("Password: ")
n = len(password)
if (n >= 8) and (n < 64):
  print("Password accepted")

The and Python keyword evaluates two Boolean expressions according to the following table:

a\b True False
True True False
False False False

That is, a and b evaluates to True if and only if both a and b evaluate to True.

Send

Conjunction

Hint
Beginner

Input a username and input a password. Check if they equal "JohnDoe" and "Password123!", respectively. If so, print Authenticated; otherwise, print "Wrong username or password".

Help
Solve
Reset
Run
Submit
 

Test results

Test result #
Expected output
Your output

Your email has been verified!