I am writing a script for prompting for a username. Username needs to be 3 or more and 10 or less characters in length. I want to refactor the code using while instead of repeating to prompt.
def hint_username(username):
    if len(username) < 3:
        print("Invalid Username, minimum of 3 characters")
        myUser = input("Please enter username: ")
        hint_username(myUser)
    elif len(username) >10:
        print("Invalid Username, maximum of 10 characters")
        myUser = input("Please enter username: ")
        hint_username(myUser)
    else:
        print("Valid Username")
myUser = input("Please enter username: ")
hint_username(myUser)
 
     
    