import random def guess_bot(): bot = random.randint(1, 100) # time = int(input("你觉得能猜对需要的次数:")) # for i in range(1,time + 1): 如下这里最大能猜的次数为 12 (13-1) 次 for i in range(1, 13): me = int(input("请输入你猜到的数:")) if me > bot : print("再小一…
题目要求:在1-20中随机生成一个数字,你来猜,只有6次机会. 举例一: #!/usr/bin/python # -*- coding: UTF-8 -*- import random secretNumber=random.randint(1,20) print "I'm thinking of a number between 1 and 20." times = 0 for i in range(1,7): print "Take a guess:" gues…