Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve the following programming problem the code must be done in python also remember to follow the instructions to the teeth make sure the

please solve the following programming problem the code must be done in python also remember to follow the instructions to the teeth make sure the function returns 1-6 as stated in the instructions if you wrote the code repil please post the link I wont forget to like the answer thank you

image text in transcribed

image text in transcribed

Roll a dice many times, you will see that each face value will count of roughly 1/6 write a function roll a dice once, return value will be 1-6, use your functin call your function 6000 times count how many times of face 1 count how many times of face 2 print out the numbers of total face 1, 2, ..., 6 you counted I wrote a flip coin code for your reference, you can make the rolling dice similarily. function return 1 or 0 in this case call function 10000 times and print out In [15]: import random def flip_coin(): x = random.random() if x > 0.5: return 1 else: return o #test the function print(flip_coin()) In [22]: # use the function defined above ere to search o ^ = 2:58 AM 1) 2/10/2020 4 In [22]: # use the function defined above random.seed (0) heads = 0 tails = 0 for i in range (10000): x = flip coin() if x == 0: heads = heads + 1 else: tails = tails + 1 print(" heads:", heads, " \t tails:", tails) heads: 4980 tails: 5020

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

What is focal length? Explain with a diagram and give an example.

Answered: 1 week ago

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago