I feel a bit blonde right now, but for some reason I can't figure out how to solve this.
Need to correct these two issues.
- using // integer division messes up the average.
Also, I need to use the format function to get 2 decimal places
def viewscores(scores):
sum_scores = sum(scores) average = float(sum_scores // len(scores)) ### here is where I am having the results displayed print ("The scores are these: " + str(scores)) print ("The Average score now is: " + str(average))
def main():
scores = [] scores_file = open('scores.txt', 'r') line_list = list(scores_file.readlines()) scores_file.close() i = 0 while i < len(line_list): scores.append(int(line_list[i].strip())) i += 1 viewscores(scores)
main()