Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
400 B
2
Indexable
Never
input_scores = input("請輸入成績,用空格分隔每一科: ").split()
scores = []

for input_score in input_scores:
    scores.append(int(input_score))

for score in scores:
    print(f"已加入 {score}")

total_scores = sum(scores)
average_score = total_scores / len(scores)

print("謝謝填寫")
print(f"您共輸入了{len(scores)}科的成績,您的平均成績為{average_score:.1f}")
Leave a Comment