标签:不能 pytho 队列 collect python基础 查询 history bre pen
1 #-*-coding:utf-8-*- 2 from random import randint 3 from collections import deque 4 import pickle 5 guess_num = randint(0,100) 6 7 history = deque([],5) 8 9 while(True): 10 num = input("请输入你猜的数字\n") 11 if num == "history": 12 13 print(history) 14 try: 15 num = int(num) 16 except: 17 print(history) 18 19 history.append(num) 20 21 22 if num == guess_num: 23 print("猜对了") 24 break 25 elif num<guess_num: 26 print("小了") 27 elif num>guess_num: 28 print("大了") 29 30
标签:不能 pytho 队列 collect python基础 查询 history bre pen
原文地址:http://www.cnblogs.com/ruoniao/p/6838021.html