# 计算出因子里面4和7的个数

<p>输入一个正数n&#xff0c;计算出因子里面分别有几个4和7&#xff0c;输出因子中4和7的个位数</p>

以下程序实现了这一功能，请你填补空白处内容：

```python
n = int(input("输入数字："))
factor = [n]   
num = 1
__________________;
print(factor)
m = [str(i) for i in factor]
count4 = 0
count7 = 0
for i in m:
	if '4' in i:
		count4 += 1
		print('以4结尾的因子的个位数：', int(i)%10)
	if '7' in i:
		count7 += 1
		print('以7结尾的因子的个位数：', int(i)%10)
print('因子里面分别有{0}个4和{1}个7'.format(count4,count7))
```

## template

```python
n = int(input("输入数字："))
factor = [n]   
num = 1
while num <= n/2+1:
	if n % num == 0:
		factor.append(num)
	num = num + 1
print(factor)
m = [str(i) for i in factor]
count4 = 0
count7 = 0
for i in m:
	if '4' in i:
		count4 += 1
		print('以4结尾的因子的个位数：', int(i)%10)
	if '7' in i:
		count7 += 1
		print('以7结尾的因子的个位数：', int(i)%10)
print('因子里面分别有{0}个4和{1}个7'.format(count4,count7))
```

## 答案

```python
while num <= n/2+1:
	if n % num == 0:
		factor.append(num)
	num = num + 1
```

## 选项

### A

```python
while num <= n + 1:
	if n % num == 0:
		factor.append(num)
	num = num + 1
```

### B

```python
while num <= n + 1:
	if n % num == 1:
		factor.append(num)
	num = num + 1
```

### C

```python
while num <= n/2+1:
	if n % num == 1:
		factor.append(num)
	num = num + 1
```