Click here to Skip to main content
16,020,633 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
A dishonest casino has two dice: a fair die; and a loaded die.
The dishonest casino starts with one of the two dice at random (with equal probability of choosing either die).
The probability function of the fair die is as follows, where P_F (x) represents the probability of rolling an x on the fair die:

P_F (1)= P_F (2)= P_F (3)= P_F (4)= P_F (5)= P_F (6)=1/6

Implement a simulation that returns the mean of t die rolls made by a fair casino that uses only fair dice

What I have tried:

I tried something with python but since I am new, i didnt manage
Posted
Updated 15-Jan-23 20:20pm
Comments
Patrice T 15-Jan-23 16:59pm    
Show your work so far. Explain your approach, your problems.
and we will help you to fix your code.
Amarnath S 16-Jan-23 0:43am    
You can see some sample code on rolling a die, in this article of mine - https://www.codeproject.com/Articles/1247382/An-Interesting-Problem-in-the-History-of-Probabili
You can then modify this code to your requirements.
Ced 2023 16-Jan-23 1:10am    
Thank you very much that helped alot 😊

What is very strange in your requirements it is the introduction of a dishonest casino that eventually plays no role.
Anyway, your task is straightforward: generate a sequence of die rolls (hint: use random.randint method, see random — Generate pseudo-random numbers — Python 3.11.1 documentation[^]) computing, on the fly, their sum. Then divide the sum by the number of the rolls.
 
Share this answer
 
Comments
Richard Deeming 16-Jan-23 5:36am    
Surely "dishonest casino" is a pleonasm? :)
CPallini 16-Jan-23 5:54am    
:-)
Maciej Los 16-Jan-23 15:22pm    
5ed!
CPallini 16-Jan-23 15:27pm    
Thank you very much, Maciej.
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900