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
