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 instrctuions if you wrote the code repil please post the link I wont forget to like the answer thank youimage text in transcribedimage text in transcribed

O M Inbox (859) -- M Inbox (6,648) Upload Assign Catholic Unive Icam-us-cast Gfcburay 12th Downloads/ HW2 Garr x C Practice. Fur G Blackjack AG + V - X localhost:8888otebooks/Downloads/HW2%20Game.ipynb (10) YouTube M NI Mail - Okpalariche Courses - Blackboard 3 CSS Combinators c5s Units Explained. Student Services ME VIZ Read One Piece Watch full episode Find on page Enter text to search No results Options jupyter HW2 Game Last Checkpoint. Last Wednesday at 5.11 PM (autusawud) Logout Insert Help Trusted Python 3 O File B Edit x View B Cell N Run Kernel c Widgets Code: + 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 8000 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 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 #test the function print(flip_coin() In [22]: # use the function defined above Type here to search A 258 AM 40 2/10/2020 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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions