代码如下: import random n = 0 sum = 0 while n < 10: num = random.randint(1, 100) sum = sum + num n += 1 print(num, end=",") print() print("10个数的和为:%d" % sum) print("10个数的平均值为:%.2f" % (sum / 10))运行结果: