top of page

If Operations

Checkpoint #1

Whitespace

Elif

Checkpoint #2

Nested If

Summary

Checkpoint #1

So far, we've covered if statements. Test what you've learned with the following exercises:

​

What would you expect the output of the following code?

1 handedness = "right"

2 if handedness == "left":

3     print("You are left-handed")

4 if handedness != "left": 

5     print("You are right-handed")

There is another way to write this same code!

​

Try running the following code below:

1 handedness = "right"

2 if handedness == "left":

3     print("You are left-handed")

4 else: 

5     print("You are right-handed")

bottom of page