Created
April 6, 2020 09:58
-
-
Save Celia-code/0059c137998240b136cc8f80d50c69ff to your computer and use it in GitHub Desktop.
while循環
This file contains 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
member = 0 | |
amount = 0 | |
total = 0 | |
while amount != -1: | |
member += 1 | |
total += amount | |
amount = int(input("請輸入第 %d 會員消費金額:" % member)) | |
average = total/(member - 1) | |
print("會員總消費金額: %d, 人均消費金額: %5.2f" % (total, average)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment