code: TU06 POINTS: 12
If statements are great to check a whole range of things, but using them with numbers are really helpful. You can use a whole range of statements.
< less than
<= less than or equal to
> greater than
>= greater than or equal to
== equal
!= not equal
Here is an example:
< less than
<= less than or equal to
> greater than
>= greater than or equal to
== equal
!= not equal
Here is an example:
What if somebody also lives in Kaula Lumpur, it would be nice to say that too right? A little extra code will help.
elif TwinTowers == MyCityTallestBuilding:
print("You must live in KL too!")
elif simple stands for else if and enables you to continue narrowing down your options. Once you have no more choices finish with an else.
else:
print("Wow! Your city has a very tall building!")
elif TwinTowers == MyCityTallestBuilding:
print("You must live in KL too!")
elif simple stands for else if and enables you to continue narrowing down your options. Once you have no more choices finish with an else.
else:
print("Wow! Your city has a very tall building!")
Exercise 1: Create an IF number set measuring your height against other people. To make it simple do it in cm.