DataDriven
LearnPracticeInterviewDiscussDailyJobs

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
L4

Problem

Given 5 dice, return a dict with scores for all Yahtzee categories: 'ones' through 'sixes' (sum of matching dice), 'three_of_a_kind' (sum of all if >=3 match else 0), 'four_of_a_kind', 'full_house' (25 if 3+2 pattern), 'small_straight' (30 if 4 consecutive), 'large_straight' (40 if 5 consecutive), 'yahtzee' (50 if all 5 match), 'chance' (sum of all).

Summary

Five dice. Six faces. Score it.

Practice This Problem

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

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons