<分区>
这是我要运行的代码的一部分:
def func1():
a = True
while a == True:
try:
guess = int(input("guess it: "))
a = False
except ValueError:
print("Not a valid number.")
import random
number = random.randint(0, 50)
print("Im thinking of a number between 0 and 50,")
func1()
if guess == number:
print("Perfect, you got it from the first try!")
我不知道为什么我得到这个:NameError: name 'guess' is not defined, even though I defined it in "func1"