A game rolls a die 10 times and counts how many times the number 5 or 6 shows up.

(a) If there are a total of seven or more times, the win is 2 dollars.
(b) a total of four or more times but less than seven, the win is 1 dollars.
(c) a total of three or less, the win is 0 dollars.

Write a function called payOut that has an input row array of 10 integers representing the ten rolls of dice, and calculates the pay out.

Respuesta :

Answer:

Explanation:

Let's do this in python. We can start by filtering the result by 5 and 6. Then we will count the number of items in the filtered array. Finally, a conditional statement to output the result.

def payOut(ten_rolls):

    five_or_six = [roll for roll in ten_rolls if roll in [5,6]]

    count_5_or_6 = len(five_of_six)

    if count_5_or_6  >= 7:

         return 2

    elif count_5_or_6 >=4:

         return 1

    else return 0

We are applying the python formula. Then We can start by filtering the result by 5 and also 6.

python

After that Then we will count the number of items in the filtered array. After that the result a conditional statement to output the result. def payOut(ten_rolls): five_or_six = [roll for roll in ten_rolls if roll in [5,6]] count[tex]_5_or_6 =[/tex] len(five_of_six) if count[tex]_5_or_6 >= 7[/tex]: return 2 elif count_5_or_6 >=4: return 1 else return 0

Find out more information python here:

https://brainly.com/question/14492046