Last active
September 1, 2016 02:17
-
-
Save jjlumagbas/777a2290663756a78dd031bc0da72f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The Kapehan coffee shop sells coffee | |
# beans at P850 per kilo plus the | |
# cost of shipping. Each order ships | |
# for P185 per kilo + P250 fixed cost | |
# per shipment for overhead. | |
# Write a function that calculates the | |
# cost of an order. | |
# def order_cost(kilos): | |
# """ | |
# (number) -> number | |
# Calculates the cost of an order, including | |
# shipping, given the number of kilos ordered | |
# """ | |
# return 0 | |
# def order_cost(kilos): | |
# """ | |
# (number) -> number | |
# Calculates the cost of an order, including | |
# shipping, given the number of kilos ordered | |
# """ | |
# return ... kilos 850 185 250 | |
def order_cost(kilos): | |
""" | |
(number) -> number | |
Calculates the cost of an order, including | |
shipping, given the number of kilos ordered | |
""" | |
return (850 * kilos) + (185 * kilos) + 250 | |
print(order_cost(1)) # expect 1285 | |
print(order_cost(2)) # expect 2320 = (850 * 2) + (185 * 2) + 250 | |
print(order_cost(3)) # expect 3355 = (850 * 3) + (185 * 3) + 250 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment