Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Love calc assignment
Post Body

My assignment is to create a 'love calculator" I need to compare the input to a list of letters. The problem I am trying to solve is my code is giving a count of each letter not a total number of matches. Well it is but not in a way that is useful to me. Thanks for your help

def count_items_in_strings(search_list, name1):
count_dict = {}

# Convert search items to lowercase for case-insensitive search
search_list = [item.lower() for item in search_list]

for string in name1:
    # Convert the input string to lowercase
    name1 = string.lower()

    for item in search_list:
        count = name1.count(item)
        if item in count_dict:
            count_dict[item].append(count)
        else:
            count_dict[item] = [count]

return count_dict
#inputs
name1 = 'Angela Yu'
search_list = ['t', 'r','u','e', 'l', 'o','v','e']
counts = count_items_in_strings(search_list, name1)
Print the results
print(counts)

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
123,126
Link Karma
3,528
Comment Karma
119,000
Profile updated: 1 week ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago