|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import easygui as g
import random
def f(guess):
msg = '当てみて(1~10)'
title = 'ゲーム'
guess = g.integerbox(msg,title,lowerbound =1, upperbound=10)
while True:
if guess == secret:
g.msgbox('すげー、ひとつあたり')
break
else :
if guess >secret:
g.msgbox('大きすぎた')
else:
g.msgbox('小さすぎた')
guess = g.integerbox(msg,title,lowerbound =1, upperbound=10)
g.msgbox('みんな一緒に当てみて')
secret = random.randint(1,10)
f(guess)
Traceback (most recent call last):
File "C:/Users/dell/Desktop/f(guess).py", line 23, in <module>
f(guess)
NameError: name 'guess' is not defined
函数调用之前,根本没有定义guess
而且,根据你的写法,函数f根本不需要传递guess参数
|
|