Skip to content

Files

Latest commit

 

History

History

08.1-Your-First-If

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
tutorial

08.1 Your First If...

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:

📝 Instructions:

  1. If the user has more than $100, we answer: "Give me your money!".

  2. If the user has more than $50, we answer: "Buy me some coffee, you cheap!".

  3. If the user has less than or equal to $50, we answer: "You are a poor guy, go away!".

💡 Hints:

  • Use an if...else statement to check the value of the total 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