# 要求编写函数fn(a,n) 求a+aa+aaa++⋯+aa⋯aa(n个a）之和，fn须返回的是数列和

<p>要求编写函数fn(a,n) 求a&#43;aa&#43;aaa&#43;&#43;⋯&#43;aa⋯aa(n个a&#xff09;之和&#xff0c;fn须返回的是数列和。
从控制台输入正整数a和n的值&#xff08;两个值都不超过9&#xff09;&#xff0c;并输出fn(a,n)的结果值。</p>

## template

```python
def fun(a,n):
	s = 1
	sum = 1
	for i in range(1,n):
		s = 1 + s*10
		sum+=s
	y = a *sum
	print(y)
def main():
	while(1):
		a = int(input('请输入a:'))
		if a>9 or a<0: 
			print('a的值输入错误，请重新输入：')
		else:
			break
	while(1):
		n = int(input('请输入n:'))
		if n>9 or n<0: 
			print('n的值输入错误，请重新输入：')
		else:
			break
	fun(a,n)
if __name__ == '__main__':
	main()
```

## 答案

```python

```

## 选项

### A

```python

```

### B

```python

```

### C

```python

```