If-Else Statements

1 / 4

An if statement can execute code based on whether a Boolean value is true or false. Consider this code:

if (n >= 0):
  print("n is positive")
else:
  print("n is negative")

If the value of n is zero or higher, the program prints n is positive. Otherwise, n is negative is printed. It is very important to note that the print statements are indented: they have some whitespace before them.

Boolean conditions

Input a password. If the password equals Password123!, the program should print access granted. Otherwise, it should print access denied.

Congratulations!

You passed the !

Welcome!

Would you like a guided tour on how to use Vibewise?

Your email has been verified!