Skip to content

Latest commit

 

History

History
 
 

14.1-letter_counter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

14.1 Letter counter

📝 Instructions:

Our customer needs a program that counts the letter repetitions in a given string, for example:

The string "Hello World" contains the following repetitions h=1 e=1 l=3 o=2 w=1 r=1 d=1.

  1. Count the letters of the string in the variable par and print the number of times a letter is repeated throughout the string.

  2. Capitalization should not affect the count (i.e. if there is a string that contains a capital A as well as a lowercase a the count for "a" should be 2).

  3. Spaces should be ignored!

💻 Expected result:

print(count("Hello World"))
# This will print: {'h': 1, 'e': 1, 'l': 3, 'o': 2, 'w': 1, 'r': 1, 'd': 1}