In Python, how to get the sum and average while in a loop
问题 I've managed to implement a loop but keep getting a syntax error when I try the sum function. I need the numbers input by the user to be totalled and the average given as well. This has to be outputted to the user. Could you please guide me on where to go from here, thank you. This is what I've done so far: while 1: NumCalc = input ("Enter Number :") if NumCalc == "done": break 回答1: This is what you can do if you want to compute the sum and the mean after the loop ends: nums = [] while 1: