# python 编程 猜数字

<p>游戏&#xff08;猜数字&#xff09;&#xff1a;随机生成一个数字&#xff08;取值范围&#xff3b;1&#xff0c;100&#xff3d;&#xff09;。让用户猜数字&#xff0c;并给出相应的提示&#xff1a;
如果用户输入比答案大&#xff0c;提示‘Too big&#xff0c; try again’&#xff1b;
反之&#xff0c;提示‘Too small, try again’&#xff1b;
如果猜中了&#xff0c;提示‘Congratulations!’。
最后&#xff0c;要给出反馈&#xff08;答案&#xff0c;猜的次数&#xff0c;猜的历史&#xff09;。
 </p>

## template

```python
import random
v=random.randint(1,100)
count=0
his=[]
while 1:
	vi=input("输入猜测值：")
	count+=1
	his.append(vi)
	if int(vi)>v:
		print("Too big,try again")
	if int(vi)<v:
		print("Too small,try again")
	if int(vi)==v:
		print('Congratulations!')
		break
print("答案是：%d" % v)
print("猜测次数：%d" % count)
st=''
for i in his:
	st+=i
	st+=','
st=st[:-1]
print("猜测历史：%s" % st)
```

## 答案

```python

```

## 选项

### A

```python

```

### B

```python

```

### C

```python

```