tutorial |
---|
The current application is asking how much money the user has. Once the user inputs the amount, we need to print one of the following answers:
-
If the user has more than $100, we answer: "Give me your money!".
-
If the user has more than $50, we answer: "Buy me some coffee, you cheap!".
-
If the user has less than or equal to $50, we answer: "You are a poor guy, go away!".
-
Use an
if...else
statement to check the value of thetotal
variable. -
Further information here.
-
Here's a quick reminder on relational operators:
Operator Description Syntax > Greater than: True if the left operand is greater than the right x > y < Less than: True if the left operand is less than the right x < y == Equal to: True if both operands are equal x == y != Not equal to: True if operands are not equal x != y >= Greater than or equal to: True if the left operand is greater or equal x >= y <= Less than or equal to: True if the left operand is less or equal x <= y