我遇到了一个问题。我的任务之一是制作一个输入3个测试分数并获得平均值的程序,平均值应该紧跟在后面的“%”符号上。我不太确定在print语句中添加“%”符号的位置。我梳理了书,找不到任何东西。
keep_going = "y"
while keep_going == "y":
test_1 = int(input(" Enter a test score: "))
test_2 = int(input(" Enter a test score: "))
test_3 = int(input(" Enter a test score: "))
score = (test_1 + test_2 + test_3) / 3.0
print(" Score ", format(score, ".3f",), sep="")
keep_going = input(" Would you like to continue? (Enter y for yes)")
答案 0 :(得分:0)
这对我有用:
print(" Score ", format(score, ".3f",) + "%")