求s=a+aa+aaa+aaaa+aa...a的值
其中a是一个数字,多少个数字相加由键盘输入控制
a = int(input("数字:"))
count = int(input("个数:"))
s = ''
result = 0
for i in range(1, count + 1):
# 第i个数字有i个a
num = str(a) * i
if s:
s = s + '+' + num
else:
s = num
# 将数字累加
result += int(num)
print("{} = {}".format(s, result), )