Question

Emulate a die roll by creating a random number between 1 - 6, store 5 rolls...

Emulate a die roll by creating a random number between 1 - 6, store 5 rolls in a set called roller and then print out the set, python

Homework Answers

Answer #1

Python code:

import random
#initializing roller as an empty set
roller=set()
#looping for 5 times
for i in range(5):
    #adding a random number in each roll to the set roller
    roller.add(random.randint(1,6))
#printing roller
print(roller)


Screenshot:


Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Suppose you roll a fair 100-sided die. What is the expected number of rolls you would...
Suppose you roll a fair 100-sided die. What is the expected number of rolls you would have to make to roll a 100? What is the expected number of rolls you would have to make to have rolled a 98, 99, and 100?
1. Suppose you have a fair 6-sided die with the numbers 1 through 6 on the...
1. Suppose you have a fair 6-sided die with the numbers 1 through 6 on the sides and a fair 5-sided die with the numbers 1 through 5 on the sides. What is the probability that a roll of the six-sided die will produce a value larger than the roll of the five-sided die? 2. What is the expected number of rolls until a fair five-sided die rolls a 3? Justify your answer briefly.
Kate rolls a 6-die and Peter rolls an 8-die. 1. What is the probability that Kate...
Kate rolls a 6-die and Peter rolls an 8-die. 1. What is the probability that Kate rolls a larger number than Peter? 2. What’s the probability that the dice add to a value of 4 or lower?
2.29 Die rolls. You roll a die three times. what is the probability the sum of...
2.29 Die rolls. You roll a die three times. what is the probability the sum of the first two rolls is equal to the third roll? 3.3 Off to the races. Suppose mike places three separate bets on three separate tracks. Each bet is for a specific horse to win. His horse in race 1 wins with probability 1/5. His horse in race 2 with probability 2/5. His horse in race 3 wins with probability 3/5. What is the probability...
Roll a die (a) What is the probability of getting the first 6 at or before...
Roll a die (a) What is the probability of getting the first 6 at or before the fifth roll? (b) What is the probability of getting the third 6 at the tenth roll? (c) What is the expected number of rolls to get the fifth 6? (d) Given that the second 6 occurred at the tenth roll, what is the probability that the first 6 occurred at the fifth roll?
I have a 6 sided die with the numbers 1, 2, 3, 3, 4, 5 on...
I have a 6 sided die with the numbers 1, 2, 3, 3, 4, 5 on it. I also have a hat filled with numbers. When I pick a number out of the hat, I get a number between 1 and 10. The hat number has a mean of 2 and a standard deviation of 2.5. I make a new random variable by combining these two previous random variables. The new random variable is made by taking the number I...
I roll one die and my friend rolls another die. What is the probability that at...
I roll one die and my friend rolls another die. What is the probability that at least one of us gets an even number? Let R and S be two independent and identically distributed random variables. E(R) = E(S) = 4. V(R) = V(S) = 3. Let T = R – S. What is V(T)? Let V(X) = 49. What does the Cov(X,X) equal?
A 6-sided die rolled twice. Let E be the event "the first roll is a 1"...
A 6-sided die rolled twice. Let E be the event "the first roll is a 1" and F the event "the second roll is a 1". Find the probability of showing a 1 on both rolls. Write your answer as a reduced fraction.
If you roll a die, you get one of the following numbers: 1, 2, 3, 4,...
If you roll a die, you get one of the following numbers: 1, 2, 3, 4, 5, 6. Each possibility occurs with equal probability of 1/6. The expected value of a dice roll is E(D)= 3.5 and the variance of a dice roll is Var(X) = 2.917. a) Suppose you roll a die and then add 1 to the roll to get a new random variable taking one of the following numbers: 2,3,4,5,6,7. What is the variance of this new...
8 Roll a fair (standard) die until a 6 is obtained and let Y be the...
8 Roll a fair (standard) die until a 6 is obtained and let Y be the total number of rolls until a 6 is obtained. Also, let X the number of 1s obtained before a 6 is rolled. (a) Find E(Y). (b) Argue that E(X | Y = y) = 1/5 (y − 1). [Hint: The word “Binomial” should be in your answer.] (c) Find E(X).
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT