• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# CS1301xII Coding Problem 3.2.5

CryptoJones Nov 29th, 2018 (edited) 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. cafe = "Octane"
2. balance = 7.5
3.
4. #You may modify the lines of code above, but don't move them!
5. #When you Submit your code, we'll change these lines to
6. #assign different values to the variables.
7.
8. #Atlanta is full of great coffee places. Unfortunately, great
9. #coffee is usually expensive. The variables above will
10. #contain a balance and a cafe name. Below are the prices of
11. #a cup of coffee at each of three locations:
12. #
13. # - Octane: \$6
14. # - Galloway: \$5
15. # - Starbucks: \$4
16. # - Revelator: \$3
17. # - Dunkin: \$2
18. #
19. #Add some code above that will print one of the following
20. #two messages depending on whether the value of balance is
21. #high enough to buy a cup of coffee at the given cafe.
22. #
23. # - If it is sufficient, print "With [balance] dollars, I
24. #   can buy coffee at [cafe]"
25. # - If it is not sufficient, print "With [balance] dollars,
26. #   I cannot buy coffee at [cafe]"
27.
28.
30.
31. if (cafe=="Octane"):
32.     if (balance >= 6):
33.         print("With {} dollars, I can buy coffee at {}".format(balance, cafe))
34.     else:
35.         print("With {} dollars, I can not buy coffee at {}".format(balance, cafe))
36. elif (cafe=="Galloway"):
37.     if (balance >= 5):
38.         print("With {} dollars, I can buy coffee at {}".format(balance, cafe))
39.     else:
40.         print("With {} dollars, I can not buy coffee at {}".format(balance, cafe))
41. elif (cafe=="Starbucks"):
42.     if (balance >= 4):
43.         print("With {} dollars, I can buy coffee at {}".format(balance, cafe))
44.     else:
45.         print("With {} dollars, I can not buy coffee at {}".format(balance, cafe))
46. elif (cafe=="Revelator"):
47.     if (balance >= 3):
48.         print("With {} dollars, I can buy coffee at {}".format(balance, cafe))
49.     else:
50.         print("With {} dollars, I can not buy coffee at {}".format(balance, cafe))
51. elif (cafe=="Dunkin"):
52.     if (balance >= 2):
53.         print("With {} dollars, I can buy coffee at {}".format(balance, cafe))
54.     else:
55.         print("With {} dollars, I can not buy coffee at {}".format(balance, cafe))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top