python猜数字游戏
#-*- encoding:utf-8 -*-
from tkinter import *
import tkinter.simpledialog as shuru
import tkinter.messagebox as xianshi
yan=Tk()
yan1=Label(yan,text="猜数字游戏")
yan1.pack()
xianshi.showinfo("欢迎","欢迎你来到猜数字游戏")
n=14
while True:
m = shuru.askinteger("数字","请输入一个数字!")
if m==n:
output="哇!好厉害,你猜对了!"
xianshi.showinfo("提示",output)
break
elif m < n:
output="错了,再大点"
xianshi.showinfo("提示", output)
else:
output="错了,再小点"
xianshi.showinfo("提示", output)
还没有评论,来说两句吧...