# -*- coding: cp936 -*- import random n = 0 m = 0 i = random.randint(1,100) #print i print"猜数字游戏开始了:" print"一共有六次机会,猜一个1-100的数字" while m < 6 and n != i: n = input("请输入一个1-100的数字") if n == i: print "恭喜你猜对了" break elif n > i: print "大了" else: print "小了" m = m + 1 else: print "六次你都没有猜中!"
时间: 2024-10-28 21:38:33