diff --git a/Codecademy.md b/Codecademy.md index 2b3213f..f515096 100644 --- a/Codecademy.md +++ b/Codecademy.md @@ -87,10 +87,16 @@ strings""" True = int(1) False = int(0) +## Boolean Expressions + + `and` evaluates true if both are true. + `or` evaluates true if either are true. + `not` return the opposite boolean value. + ## Relational Operators (ch.4, ex. 3) - `==` returns `True` if is is equal and returns `False` otherwise. - `!=` returns `True` if is is NOT equal and returns `False` otherwise. + `==` returns `True` if is is equal + `!=` returns `True` if is is NOT equal Here are more of he same kind of operator: @@ -98,9 +104,8 @@ False = int(0) `<` less than `>=` greater than or equal to `<=` less than or equal to - - - +# if, else, if else + `elif` = if else # Datatypes diff --git a/h.py b/h.py new file mode 100644 index 0000000..954d94f --- /dev/null +++ b/h.py @@ -0,0 +1,17 @@ +def ground_shipping(weight): + flat = 20.00 + + if weight <= 2: + cost = flat + 1.50 * weight + if (weight > 2) and (weight <= 6): + cost = flat + weight * 3.00 + if (weight > 6) and (weight <= 10): + cost = flat + weight * 4.00 + if (weight > 10): + cost = flat + weight * 4.75 + + return cost + +premium_ground_shipping = 125.00 + +print(premium_ground_shipping(8.4))