在python中循环平均分数?

2admgd59  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(224)

由于某种原因,当我平均分数时,它不是正确的答案,即通常是2%或540,即使这不是算术答案。有时行,有时不行!同样,代码在vs中运行,但在idle中显示语法错误。我不知道他们是否有关联,但无论如何,我不知道该怎么解决。感谢您的帮助!

number=1
quiz=1
mini=1
peer=1
sum=0
while number <51:
    assignment = int(input("What's your grade for assignment "+ str(number) + "?"))
    number = number + 1
    sum += assignment
    assigns = (sum // 500)*100
    assigns2 = round(assigns, 2)
while peer <4:
    peers = int(input("What is your grade for peer assignment "+ str(peer) + "?"))
    peer = peer + 1
    sum += peers
while quiz <11:
    quizzes = int(input("What's your grade for quiz "+ str(quiz) + "?"))
    quiz = quiz + 1
    sum += quizzes
    quiznos = (sum // 100)*100
    quiznos2 = round(quiznos, 2)
while mini <11:
    minisss = int(input("What is your grade for mini-project "+ str(mini) + "?"))
    mini = mini + 1
    sum += minisss
    miniz = (sum // 200)*100
    miniz2 = round(miniz, 2)
final = int(input("What was your score on the final? "))
print("CALCULATING YOUR GRADE...")
gradez = (sum/1200)*100
grader = round(gradez, 2)
print("*******")
print("The total possible points was 1100, and your total is",sum,"points! Your grade is", grader, "percent!")
print("*******")
if grader >= 90:
    print("You've gotten an A!")
elif grader >= 80:
    print("You've gotten a B!")
elif grader >= 70:
    print("You've gotten a C!")
elif grader >= 60:
    print("That's a D, sorry man!")
elif grader >= 0:
    print("You've failed the class...")
print("*******")
print("You got a", assigns2, "percent for assignments!")
print("*******")
print("You got a", quiznos2, "percent for quizzes!")
print("*******")
print("You got a", miniz2, "percent for mini projects!")
print("*******")
examity = (final / 300)*100
examity2 = round(examity, 2)
print("Your final was", final, "out of 300, for a grade of", examity2, end="!")

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题