Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Could you please help me solve this 2 questions? (d) You are helping the Mathematics Department to work on statistic research. In the games using
Could you please help me solve this 2 questions?
(d) You are helping the Mathematics Department to work on statistic research. In the games using two 6-face dice, one of them is purposely replaced with faces of 1,1,2, 3,4,5 so that 6 will never come out. Assume that you know a normal 6-face die has faces 1,2,3,4,5,6. For curiosity, you wish to know how the outcome, which is the sum of throwing the 2 dice (with one of them is a special die), will be. Write a program that rolls two dice of which one of the dice with the above defect, calculate the outcome, collect the statistics and find out the probability of rolling each possible outcome. Roll 1000 times and then print out the frequency (number of times having each of the outcome values) and also print the corresponding graph. Submit your solution in q1d.py. [10 marks] The program should require no input. The output should look like the example below. Note that due to randomness the exact frequencies will change. The bar chart should be scaled appropriately for analysis. 7AM12/17/22 4 MPS258 Assignment 2 (Autumn 2022) Hints: - Use the following to print the sum and frequency in a right-aligned style. print ({:>2}(:>5) ', format (s, freq), end=' ) Specific Requirements of Question (a) A promotion is organized by a shopping mall. A lucky draw is held according to the customer's name and should satisfy the following conditions. - Has more "Category III" letters than "Category II" letters. - Has no "Category I" letters. Assume that the customer name contains only uppercase letters and spaces. Complete the following function that returns True if the customer name win the lucky draw, and False if otherwise. If the parameter name is not a string, return None. def isWinLuckyDraw (name) Submit your solution in q2a.py. [16 marks]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started