How do i return a boolean value from a function?

In the following code im trying to make a login page but i encountered a problem here. the problem is, print(bool(verfied)) shows a error and says unresolved reference 'verified'.I would like the function to return a boolean value after it is called through the button.please help!!

def verification():
        verified = False
        if str(username_login.get()) == '1' and str(password_login.get()) == '1':
            verified = True
        elif str(username_login.get()) != '1' and str(password_login.get()) != '1':
            verified = False
        return verified
    login_button = Button(screen, text='Login', command=verification)
    login_button.place(relx=0.5,
                       rely=0.45,
                       anchor='center')
print(bool(verified))


Read more here: https://stackoverflow.com/questions/64951480/how-do-i-return-a-boolean-value-from-a-function

Content Attribution

This content was originally published by Nithish Kumar at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: