Example:
pw = input("enter your password:")
Input:
"bikash413SSS"
How can I know when there is integer, capital letter, etc?
Example:
pw = input("enter your password:")
Input:
"bikash413SSS"
How can I know when there is integer, capital letter, etc?
I will only suggest some of the approaches that might help you as you try to solve your problem.
One simple way to do this is to just run through the input string.
numbers = []
capitals = []
for char in pw:
if char.isdigit():
numbers.append(int(char))
elif char.isupper():
capitals.append(char)
print(numbers)
print(capitals)
By doing this, you ensure to run through the whole string. You can also use more arrays if you are looking for things other than numbers and capitals, such as special characters (e.g. #
) or lowercase letters.