Back to Lesson

Frequency Counter

Build a character distribution map.

Instructions

  • Given
    text = "abracadabra"
    .
  • Create an empty dictionary
    counts = {}
    .
  • Iterate across every character in the string. For each character, increase its count in the dictionary by 1. Use the
    .get()
    method to supply a default of 0.
  • Print the final
    counts
    object.
main.py
main.py