notebook.community
Edit and run
In [1]: import random total = 0 i = 1 n = int(input('请输入一个整数,按回车键结束')) m = random.randint(1, 9) print(m) while i <= n: total = total + ((10**i - 1) / 9) * m i = i + 1 print(total)
import random total = 0 i = 1 n = int(input('请输入一个整数,按回车键结束')) m = random.randint(1, 9) print(m) while i <= n: total = total + ((10**i - 1) / 9) * m i = i + 1 print(total)
请输入一个整数,按回车键结束4 1 1234.0