print(2 > 3)

"""
Explanation: Introduction
You have already seen that when you change the input value to a function, you often get a different output.  For instance, consider an add_five() function that just adds five to any number and returns the result.  Then add_five(7) will return an output of 12 (=7+5), and add_five(8) will return an output of 13 (=8+5).  Note that no matter what the input is, the action that the function performs is always the same: it always adds five.
But you might instead need a function that performs an action that depends on the input.  For instance, you might need a function add_three_or_eight() that adds three if the input is less than 10, and adds eight if the input is 10 or more.  Then add_three_or_eight(1) will return 4 (= 1+3), but add_three_or_eight(11) will return 19 (=11+8).  In this case, the action that the function performs varies with the input.
In this lesson, you will learn how to use conditions and conditional statements to modify how your functions run.
Conditions
In programming, conditions are statements that are either True or False.  There are many different ways to write conditions in Python, but some of the most common ways of writing conditions just compare two different values.  For instance, you can check if 2 is greater than 3.
End of explanation
"""


var_one = 1
var_two = 2

print(var_one < 1)
print(var_two >= var_one)

"""
Explanation: Python identifies this as False, since 2 is not greater than 3.
You can also use conditions to compare the values of variables.  In the next code cell, var_one has a value of 1, and var_two has a value of two.  In the conditions, we check if var_one is less than 1 (which is False), and we check if var_two is greater than or equal to var_one (which is True).
End of explanation
"""


def evaluate_temp(temp):
    # Set an initial message
    message = "Normal temperature."
    # Update value of message only if temperature greater than 38
    if temp > 38:
        message = "Fever!"
    return message

"""
Explanation: For a list of common symbols you can use to construct conditions, check out the chart below.
<table style="width: 100%;">
<tbody>
<tr><th><b>Symbol</b></th><th><b>Meaning</b></th></tr>
<tr>
<td>==</td>
<td>equals</td>
</tr>
<tr>
<td>!=</td>
<td>does not equal</td>
</tr>
<tr>
<td>&#60;</td>
<td>less than</td>
</tr>
<tr>
<td>&#60;=</td>
<td>less than or equal to</td>
</tr>
<tr>
<td>&#62;</td>
<td>greater than</td>
</tr>
<tr>
<td>&#62;=</td>
<td>greater than or equal to</td>
</tr>
</tbody>
</table>

Important Note: When you check two values are equal, make sure you use the == sign, and not the = sign.
- var_one==1 checks if the value of var_one is 1, but 
- var_one=1 sets the value of var_one to 1.
Conditional statements
Conditional statements use conditions to modify how your function runs.  They check the value of a condition, and if the condition evaluates to True, then a certain block of code is executed.  (Otherwise, if the condition is False, then the code is not run.)  
You will see several examples of this in the following sections.
"if" statements
The simplest type of conditional statement is an "if" statement.  You can see an example of this in the evaluate_temp() function below.  The function accepts a body temperature (in Celcius) as input.
- Initially, message is set to "Normal temperature".
- Then, if temp &gt; 38 is True (e.g., the body temperature is greater than 38°C), the message is updated to "Fever!".  Otherwise, if temp &gt; 38 is False, then the message is not updated.
- Finally, message is returned by the function.
End of explanation
"""


print(evaluate_temp(37))

"""
Explanation: In the next code cell, we call the function, where the temperature is 37°C. The message is "Normal temperature", because the temperature is greater than 38°C (temp &gt; 38 evaluates to False) in this case.
End of explanation
"""


print(evaluate_temp(39))

"""
Explanation: However, if the temperature is instead 39°C, since this is greater than 38°C, the message is updated to "Fever!".
End of explanation
"""


def evaluate_temp_with_else(temp):
    if temp > 38:
        message = "Fever!"
    else:
        message = "Normal temperature."
    return message

"""
Explanation: Note that there are two levels of indentation:
- The first level of indentation is because we always need to indent the code block inside a function.
- The second level of indentation is because we also need to indent the code block belonging to the "if" statement.  (As you'll see, we'll also need to indent the code blocks for "elif" and "else" statements.)
Note that because the return statement is not indented under the "if" statement, it is always executed, whether temp &gt; 38 is True or False.
"if ... else" statements
We can use "else" statements to run code if a statement is False.  The code under the "if" statement is run if the statement is True, and the code under "else" is run if the statement is False.
End of explanation
"""


print(evaluate_temp_with_else(37))

"""
Explanation: This evaluate_temp_with_else() function has equivalent behavior to the evaluate_temp() function.
In the next code cell, we call this new function, where the temperature is 37°C.  In this case, temp &gt; 38 evaluates to False, so the code under the "else" statement is executed, and the Normal temperature. message is returned.
End of explanation
"""


def evaluate_temp_with_elif(temp):
    if temp > 38:
        message = "Fever!"
    elif temp > 35:
        message = "Normal temperature."
    else:
        message = "Low temperature."
    return message

"""
Explanation: As with the previous function, we indent the code blocks after the "if" and "else" statements.  
"if ... elif ... else" statements
We can use "elif" (which is short for "else if") to check if multiple conditions might be true.  The function below:
- First checks if temp &gt; 38.  If this is true, then the message is set to "Fever!".
- As long as the message has not already been set, the function then checks if temp &gt; 35.  If this is true, then the message is set to "Normal temperature.".
- Then, if still no message has been set, the "else" statement ensures that the message is set to "Low temperature." message is printed.
You can think of "elif" as saying ... "okay, that previous condition (e.g., temp &gt; 38) was false, so let's check if this new condition (e.g., temp &gt; 35) might be true!"
End of explanation
"""


evaluate_temp_with_elif(36)

"""
Explanation: In the code cell below, we run the code under the "elif" statement, because temp &gt; 38 is False, and temp &gt; 35 is True.  Once this code is run, the function skips over the "else" statement and returns the message.
End of explanation
"""


evaluate_temp_with_elif(34)

"""
Explanation: Finally, we try out a case where the temperature is less than 35°C.  Since the conditionals in the "if" and "elif" statements both evaluate to False, the code block inside the "else" statement is executed.
End of explanation
"""


def get_taxes(earnings):
    if earnings < 12000:
        tax_owed = .25 * earnings
    else:
        tax_owed = .30 * earnings
    return tax_owed

"""
Explanation: Example - Calculations
In the examples so far, conditional statements were used to decide how to set the values of variables.  But you can also use conditional statements to perform different calculations.
In this next example, say you live in a country with only two tax brackets.  Everyone earning less than 12,000 pays 25% in taxes, and anyone earning 12,000 or more pays 30%.  The function below calculates how much tax is owed.
End of explanation
"""


ana_taxes = get_taxes(9000)
bob_taxes = get_taxes(15000)

print(ana_taxes)
print(bob_taxes)

"""
Explanation: The next code cell uses the function.
End of explanation
"""


#$HIDE_INPUT$
def add_three_or_eight(number):
    if number < 10:
        result = number + 3
    else:
        result = number + 8
    return result

"""
Explanation: In each case, we call the get_taxes() function and use the value that is returned to set the value of a variable.
- For ana_taxes, we calculate taxes owed by a person who earns 9,000.  In this case, we call the get_taxes() function with earnings set to 9000.  Thus, earnings &lt; 12000 is True, and tax_owed is set to .25 * 9000.  Then we return the value of tax_owed.
- For bob_taxes, we calculate taxes owed by a person who earns 15,000.  In this case, we call the get_taxes() function with earnings set to 15000.  Thus, earnings &lt; 12000 is False, and tax_owed is set to .30 * 15000.  Then we return the value of tax_owed.
Before we move on to another example - remember the add_three_or_eight() function from the introduction?  It accepts a number as input and adds three if the input is less than 10, and otherwise adds eight.  Can you figure out how you would write this function?  Once you have an answer, click on the "Show hidden code" button below to see the solution.
End of explanation
"""


def get_dose(weight):
    # Dosage is 1.25 ml for anyone under 5.2 kg
    if weight < 5.2:
        dose = 1.25
    elif weight < 7.9:
        dose = 2.5
    elif weight < 10.4:
        dose = 3.75
    elif weight < 15.9:
        dose = 5
    elif weight < 21.2:
        dose = 7.5
    # Dosage is 10 ml for anyone 21.2 kg or over
    else:
        dose = 10
    return dose

"""
Explanation: Example - Multiple "elif" statements
So far, you have seen "elif" used only once in a function.  But there's no limit to the number of "elif" statements you can use.  For instance, the next block of code calculates the dose of medication (in milliliters) to give to a child, based on weight (in kilograms).
Note: This function should not be used as medical advice, and represents a fake medication.
End of explanation
"""


print(get_dose(12))

"""
Explanation: The next code cell runs the function.  Make sure that the output makes sense to you!
- In this case, the "if" statement was False, and all of the "elif" statements evaluate to False, until we get to weight &lt; 15.9, which is True, and dose is set to 5.
- Once an "elif" statement evaluates to True and the code block is run, the function skips over all remaining "elif" and "else" statements.  After skipping these, all that is left is the return statement, which returns the value of dose.
- The order of the elif statements does matter here!  Re-ordering the statements will return a very different result.
End of explanation
"""


