#!/bin/python# -*- coding: UTF-8 -*-# Filename : caizi.py# 生成一个0-100以内的随机数#导入 random(随机数)模块import randomcaizi_ok=random.randint(0,1)tag_num=0while tag_num<5:# into_mun = input("请输入一个0至100的整数:")while True:try:into_mun = int(input("请输入一个0至100的整数:"))# print('get number:%d'%into_mun)breakexcept BaseException as error_try:print("error for:",error_try)if into_mun==caizi_ok:print"恭喜你猜对了,随机数为:"breakelif into_mun<caizi_ok:print("很遗憾你猜错了,随机数 比你输入的大")else:print("很遗憾你猜错了,随机数 比你输入的小")tag_num+=1if tag_num==5:print("很遗憾你的机会用完了")