5.2: 🌋 If/Else Statements

Topic

5.2: 🌋 If/Else Statements

Topic Progress:

If/Else Statements are very similar to regular if statements, but with a twist. A regular if statement will just be skipped when the condition doesn’t come back true. However, adding an ‘else’ block below an if statement will let your write code for if it comes back false as well! This can be useful when you want certain actions to not be able to happen together – the program has to choose one or the other.

In this example, the if statement will always be false (one is not greater than two), so the else block will always run:

if(1 > 2):
print("This never runs")
else:
print("This always runs")

For this exercise, you’re trying to log into a bank account, but there’s a problem! There’s something wrong with the passCode. Your task is to fix it, and open up your account.

Note: This banking system is not very secure! See if you can figure out why.

@

Not recently active