Great job! We covered a ton of material in this lesson and we’ve increased the number of tools in our Python toolkit by several-fold. Let’s review what we’ve learned this lesson:
- Boolean expressions are statements that can be either
- A boolean variable is a variable that is set to either
- We can create boolean expressions using relational operators:
!=: Not equals
>: Greater than
>=: Greater than or equal to
<: Less than
<=: Less than or equal to
ifstatements can be used to create control flow in your code.
elsestatements can be used to execute code when the conditions of an
ifstatement are not met.
elifstatements can be used to build additional checks into your
Let’s put these skills to the test!
Optional: Little Mac is an interplanetary space boxer, who is trying to win championship belts for various weight categories on other planets within the solar system.
Write a space.py program that helps him keep track of his target weight by:
- Checks which number
planetis equal to.
- It should then compute his weight on the destination planet.
Here is the table of conversion: