Count the number of filtered characters and character frequencies of a string | Python

preview_player
Показать описание
Counting the number of filtered characters means we count the characters of a string after removing its duplicates. Besides, we also return the character frequencies of a string using dictionaries and loops in python.

First, we will iterate through the string and proceed with our process by adding the key and values with some if-else statement rules.

Tags:
code setup, Count the number of filtered characters and character frequencies of a string in python, string exercises python, python 3, strings, dictionaries, exercises in python for beginners, iterations, remove duplicates of a string, character frequency, basic algorithms for beginners, working with strings in python, filter characters, dictionaries exercise in python, easy level python exercises, basic level python exercises, coding, programming, python program, remove duplicates
Рекомендации по теме
Комментарии
Автор

If we want to get the result irrespective of upper or lower cases then we can change the whole string into the upper case or lower case.
If we want the result as uppercase characters and their frequency then change the whole string to uppercase else change it to lowercase.
So for this, I create a variable and iterate through that.
string2 = string.upper()
for i in string2:

output for the above case : {G:2, O:2, L:1, E:1}
You can do string.lower() for the output {g:2, o:2, l:1, e:1}

codesetup
Автор

Make video on
write a program in Python to check whether a number can be expanded as the sum of two prime number

rutujabadre
Автор

can you make the tutorial of this code

Peter Piper picked a peck of pickled peppers
A peck of pickled peppers Peter Piper picked
If Peter Piper picked a peck of pickled peppers
Where's the peck of pickled peppers Peter Piper picked?

The number of P's and p's is
Capital letter P : 8
Small letter p : 28

using for loop

disco
visit shbcf.ru