The problem is that your not defining age out of the funtion. You need to return name and age and set them to a variable, if that makes sense. Try this:
def check_age(age):
"""This function checks wether the person is allowed to drink based on age."""
if age >= 18:
return "allowed"
else:
return "not allowed"
def enter_scrollbar():
"""This function checks for name and age."""
name = input("What is your name? ")
age = int(input("How old are you? "))
return name, age
name, age = enter_scrollbar()
legal = check_age(age)
message = f"Welcome {name}. You are {legal} to drink beer."
print(message)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…