I need to check a string (password validator) whether it contains specific characters and lenght in python. One of the condition is, that the string pwd only contains the characters a-z, A-Z, digits, or the special chars "+", "-", "*", "/".
Blockquote
These utilities should help me solve it (but I don't get it):
- Use isupper/islower to decide whether a string is upper case or lower case
- Use isdigit to check if it is a number
- Use the in operator to check whether a specific character exists in a string.
pwd = "abc"
def is_valid():
# You need to change the following part of the function
# to determine if it is a valid password.
validity = True
# You don't need to change the following line.
return validity
# The following line calls the function and prints the return
# value to the Console. This way you can check what it does.
print(is_valid())
I'd appreciate your help!