So I'm trying to start by asking the user how many scores they would like to enter. Then use a loop to request each score and add it to a total. Finally, calculate and display the average for the entered scores. Using separate subroutines/functions/methods. But I'm doing something wrong in the loopbody, can you help me?
def scoretimes(): print("How many grade scores would you like to enter?") scores = int(input()) return scores def while_loop(scores): times = 0 while times <= scores: scoreinput = float(input()) scoretotal = scoretotal + scoreinput return scoretotal times += 1 def calculation(scores, scoretotal): calculation = scoretotal / scores return calculation def main(): scores = scoretimes() while_loop(scores) calculation(scores, scoretotal) main()
Moderator Larz60+: Added code tags for you this time for future posts, please read: