Python Programming Exercises, Gently Explained
56
# Otherwise, pay for a cup of coffee:
else:
# Increase the total price:
totalPrice += ____
# Decrement the coffees left until we get a free coffee:
cupsUntilFreeCoffee -= ____
# Return the total price:
return ____
The complete solution for this exercise is given in Appendix A and
https://invpy.com/buy8get1free.py. You can view each step of this program as it runs under a debugger at
https://invpy.com/buy8get1free-debug/.
Dostları ilə paylaş: