Loading...

The Letter Tally

A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
easy
Seniority
junior, mid

Problem

Write a Python class called CharCounter that accepts a string on initialization. It must expose a method get_counts() that returns a list of (character, count) tuples sorted alphabetically by character. Spaces and punctuation should be ignored.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.