You could break it down into functions.
I've given an outline below for you to fill in the gaps.
create a constant variable for the rolled dice pattern you would like to match
I've given an outline below for you to fill in the gaps.
create a constant variable for the rolled dice pattern you would like to match
SNAKE_EYES = (1, 1)Make a function to roll dice
def roll_dice(num_of_dice): .... return # returns the rolled dice, possible result (1, 1) if called as roll_dice(2)Make a function that counts how many rolls to find a match that can be called like this
roll_till_match(SNAKE_EYES)
def roll_till_match(match): num_of_dice = len(match) .... # uses roll_dice(num_of_dice) in a loop checking if the result is the same as match return # count of rolls till the matchAnother function that can call roll_till_match x amount of times that can be called like this
roll_till_match_x_times(SNAKE_EYES, 5)
def roll_till_match_x_times(match, x_times): ... # uses roll_till_match(match) in a loop of x_times return # total sum of rollsThe same functions can be used against other matches.