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

Brian ordered 145 centimeters of fabric. Jayleen ordered 1.5 meters of fabric. Who ordered more fabric.
What happened after the Communist party dissolved itself in Hungary? Poland dissolved its Communist party too. Hungary held its first free elections. Citizens b
what kind of climate does Louisiana have
How can I solve -3x+2y= -3 and 4x-y=-1
Describe two aspects of Abraham Lincoln’s life and character before he was president.
How Does The Federalist System Affect Political Participation?
A class of 12 girls and 14 boys is going to choose 3 students to represent them in student government. Allie suggested that the first 3 students to arrive in cl
How did the extension of the right to vote in the early 1800s give people more voice in their government
what is -65 x -2? 5j + 10j?
express the percent as a rate per 100