First of all, I know that there are many similar messages that I cited below, however, as far as I know, no one answers the problem that I encountered, because all I found is asking how to search for a string in 'dict .values () ', not to search for each character in a string and check if it is in' dict.values () ', and if he found any characters in the string that appear in the' dict characters .values () 'it will return what and how much.
Links to related posts that do not answer the question, but may be useful for some:
How to search if dictionary value contains a specific string with Python
Find dictionary entries whose key matches a substring
How to check if characters in a string are in a dictionary of values?
How to search if dictionary value contains a specific string with Python
This is what I have so far, but doesn't seem to work at all ...
characters = {'small':'abcdefghijklmnopqrstuvwxyz',
'big':'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'nums':'0123456789',
'special':"!#$%&()*+,-./:;<=>?@[\]^_{|}~",}
password = 'aAb'
def count(pass_word,char_set):
num_of_char = 0
char_list = []
for char in pass_word:
if i in char_set.values():
num_of_char +=1
char_list += i
return char_list, num_of_char
print(count(password,characters))
The result should be approximately the same:
'a','A','b'
3
I hope you understand what I mean, and if something is unclear, please comment so that I can improve it.