Loading...

The Yahtzee Engine

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

Domain
Python
Difficulty
hard
Seniority
mid, senior

Problem

Implement a Yahtzee score calculator. Given five dice values, return a dictionary with the score for each of these categories: ones through sixes (sum of matching dice), three-of-a-kind (sum of all dice if 3+ match, else 0), four-of-a-kind (sum if 4+ match), full house (25 if 3+2 combo), small straight (30 if 4 consecutive values), large straight (40 if 5 consecutive), yahtzee (50 if all match), and chance (sum of all).

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.