Answer to Question #247140 in Python for Reddy

Question #247140
A data compression software utilizes various steps to compress a string of data. One of the steps involves finding the count of characters that are not repeated in the string. Write an algorithm for the software developer to find the count of characters that are not repeated in the string.
1
Expert's answer
2021-10-05T18:15:33-0400
def not_repeated_chars_count(our_string):
    my_dict = {}
    for ch in our_string:
        my_dict[ch] = my_dict.setdefault(ch, 0) + 1
    my_list = [x for x in my_dict if my_dict[x] == 1]
    return len(my_list)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS