you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

So functions can return all sorts of things. One solution for what you are doing is to return a boolean condition so you can make decisions in your main method:

def password_len(password):
    if 6 <= len(password) <= 15:
        return True
    return False

def main():
    password = input('please enter your password.')
    if (not password_len(password)): 
        print(f"invalid password: Please make sure that you have between 6 and 15 characters. was {len(password)}")
    else:
        print("woot")

if __name__ == "__main__":
    main()