Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the entered password has 8-15 characters, including at least one digit. Tell the user whenever a password fails one or both of these tests.
I have come up with somewhat of a solution but cannot seem to find if a digit is involved in the input. This is what I have come up with so far.
Can you please help me how to check if there is a digit in the password in the input? There are question marks where I feel I should put something. Thank you!
def enterNewPassword():
password = input("Enter a password: ")
if len(password) < 8:
print("Your password does not contain 8-15 characters.")
if len(password) > 15:
print("Your password contains more than 15 characters.")
if ??? not in password:
print("Your password does not contain a digit.")
if ??? in password and 8 <= len(password) >= 15:
print("Good password!")
enterNewPassword()