DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Yahtzee Scorer

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

Domain
Python
Difficulty
medium
Seniority
L3

Problem

Given 5 dice and a category string, return the score. Categories: 'ones'..'sixes' (sum of dice matching that face), 'three_of_a_kind' (sum of all dice if at least 3 dice share a face, else 0), 'four_of_a_kind' (sum if >=4 share), 'full_house' (25 if 3 of one + 2 of another, else 0), 'small_straight' (30 if 4 consecutive faces), 'large_straight' (40 if 5 consecutive), 'yahtzee' (50 if all 5 same), 'chance' (sum of all 5).

Summary

Dice scoring. Multiple categories evaluated.

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