In python using random module make a function rollDiceOddnSi

In python, using random module make a function rollDiceOdd(nSides, nDice) so that it returns the sum of only dice that land odd-numbered face up

Solution

The python program for the above is

import random

def rolled(sides, dice):

x = 0

rolled = random.randrange(1, sides+1)

for i in range(1, dice+1):

if rolled%2 == 1:          // Defines whether it is even or odd//

x = x + rolled

return x

In python, using random module make a function rollDiceOdd(nSides, nDice) so that it returns the sum of only dice that land odd-numbered face upSolutionThe pyth

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site