First of all I know that out there are many similar posts which I have listed below, however, none to my knowledge answer the problem I'm facing this is because all that I have found are asking how to search for a string in 'dict.values()' and not to search every single character in the string and check whether it is in the 'dict.values()' and if it has found any characters in the string that appear in the characters of 'dict.values()' it will return which and how many.
Links to similar posts which don't answer the question but could be useful to some:
How to search if dictionary value contains certain string with Python
Find dictionary items whose key matches a substring
How can I check if the characters in a string are in a dictionary of values?
How to search if dictionary value contains certain string with Python
This is what I have so far but don'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 result
print(count(password,characters))
The output should be something similar to:
'a','A','b'
3
Hopefully, you understand what I mean and if anything unclear please comment so that I can improve it.