From 019673fe62c45f572da6480d472596a7d56d9f2b Mon Sep 17 00:00:00 2001 From: Josh Mudge Date: Thu, 27 Dec 2018 19:50:35 -0700 Subject: [PATCH] Add shipping project. --- Codecademy.md | 15 ++++++++++----- h.py | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 h.py 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))