I am working on python. Is there a way to count how many times the values โโin the dictionary are found with more than one key, and then return the score?
So, if I had 50 values โโand I ran a script to get this, I would get an account that would look something like this:
1: 23 2: 15 3: 7 4: 5
It is said above that 23 values โโare displayed in 1 key, 15 values โโare displayed in 2 keys, 7 values โโare displayed in 3 keys and 5 values โโare displayed in 4 keys.
Also, would this question change if there were several values โโfor the key in my dictionary?
Here is an example of my dictionary (these are the names of bacteria):
{'0': ['Pyrobaculum'], '1': ['Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium', 'Mycobacterium'], '3': ['Thermoanaerobacter', 'Thermoanaerobacter'], '2': ['Helicobacter', 'Mycobacterium'], '5': ['Thermoanaerobacter', 'Thermoanaerobacter'], '4': ['Helicobacter'], '7': ['Syntrophomonas'], '6': ['Gelria'], '9': ['Campylobacter', 'Campylobacter'], '8': ['Syntrophomonas'], '10': ['Desulfitobacterium', 'Mycobacterium']}
So, from this example there are 8 unique values, I have the perfect feedback that I would get:
1:4 2:3 3:1
So, 4 bacteria names are found in only one key, 3 bacteria are found in two keys, and 1 bacteria are found in three keys.