asphongsai
asphongsai asphongsai
  • 18-12-2020
  • Computers and Technology
contestada

Define a function dice(n) that returns the sum of a random roll of n 6-sided dice. Example output in photo. Thank you

Define a function dicen that returns the sum of a random roll of n 6sided dice Example output in photo Thank you class=

Respuesta :

763396
763396 763396
  • 18-12-2020

Answer:

code (in python) is in the explanation

Explanation:

import random

def dice(n):

   count = 1

   t = list()

   while count <= n:

       i = random.randint(1,6)

       t.append(i)

       count += 1

   print(sum(t))

Hope this helps!

Answer Link

Otras preguntas

You need to measure three things: 1. a quantity of water 2. the length of a leaf 3. the mass of a small stone Which unit of metric measurement will you use fo
Where will the money that is used to be members of the Congress come from
who is president donald or hillary
This was a white southerner who supported northern Reconstruction policies after the Civil War.
What purpose does the conversation between the townsman and the stranger at the beginning of the chapter serve?
by ignoring a checkpoint in the cell cycle, a cell may become cancerous by
explain how to find 4×80. show your work.
From the topic sentence in the sample paragraph, which element or technique is being addressed? A. mantra B. irony C. character development
Write a function rule to represent the sequence. 47, 32, 17, 2,... A(n) = 47 + (n - 1)15 A(n) = 47 + (n - 1)(-13) A(n) = 47 + (n - 1)(-15) A(n) = 32 + n -
How did church authorities respond to the growing trend of eremitical monasticism?