Question
Write a program that does the following: 1. Asks the user to provide a name of the file to be used 2. Ask the user
Write a program that does the following: 1. Asks the user to provide a name of the file to be used 2. Ask the user to input the number of times three game dice (with faces numbered 1, 2, 3, 4, 5, 6) are to be tossed. This number should be no less than 216, but no more than 2,160. Do use UserInput module to validate user input. 3. Write the specified number of toss reaults (as strings) in the range 3 18 to the file specified in 1. This is to simulate tossing three dice this many times and recording the sum of the faces on top (in our picture it is 9). 4. (close the file. Then ) Read the integers from the file specified in 1 a. Use a list to keep track how many times each number was read b. Display the frequency of all numbers c. Display the number that was tossed the most, and the number that was tossed the fewest number of times. Does your program handle the case of ties? d. Display (a perhaps fictitious) average number tossed this should be a float. e. Use excel to plot your results Make sure that your program protects against invalid input. It should not crash, no matter what the user types. 4 b should be a table something like the table on the next page; 4e like the chart there
Toss result count 3 13 4 31 5 74 6 95 7 150 8 207 9 257 10 241 11 258 12 223 13 219 14 171 15 124 16 57 17 27
18 13
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