Last active
July 5, 2019 05:34
-
-
Save Shogun89/e95964b42cf28ba7faea3bf3ceeed088 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_max(my_list): | |
my_set = set(my_list) | |
my_dict = {} | |
for item in my_set: | |
my_dict[item] = my_list.count(item) | |
my_max = max(my_dict.keys(), key=(lambda k: my_dict[k])) | |
return my_max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = ['Apple', 'Orange', 'Banana', 'Peach', 'Peach'] | |
s = set(l) | |
my_dict ={} | |
for j in s: | |
my_dict[j] = l.count(j) | |
key_max = max(my_dict.keys(), key=(lambda k: my_dict[k])) |
s-o-r-r-o-w
commented
Jul 5, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment