Question: Can u please also help me with a software development plan? Your job is to write a program to simulate this nightly activity 100,000 times
Can u please also help me with a software development plan?
Your job is to write a program to simulate this nightly activity 100,000 times to determine if the zookeeper or the custodian is correct. As a simulation, you will program all steps of this process. You are not writing a statistical analysis program to calculate probabilities.
You will report the following statistics.
- What percentage of the time there is at least one elephant in the pen the zookeeper checks?
- When there is an elephant in the pen the zookeeper checks, what percentage of time are both elephants in the pen?
- Based on the results of your simulation, is the zookeeper or the custodian correct? (Use 2% points as the margin of error)
Your results should be displayed as percentages with two decimal places.
After your results are displayed, you will prompt the user to choose to end the program or run the simulation again. That way, whomever the results indicate is wrong, can easily try another simulation to see if the results were a fluke. You can use a simple message such as:
Run the simulation again? (yes or no):
Read the rubric for all requirements.
TIPS
- Your software design is very important. Make sure you've planned for every requirement and thought of a way to code each requirement individually and step-by-step. Then you can increase your confidence that your simulation is correct.
- Double check the description for what you're looking for when both elephants are in the same pen.
Common Errors
- The most common error is not understanding the logic of what you're counting. Make sure you are very clear on the three statistics listed above.
my attempted code:
import random for flucky_elect in range(1,10000): sum = 0 for factor_check in range(1,flucky_elect): if flucky_elect % factor_check == 0: random.seed(factor_check) sum += random.randint(1, flucky_elect) if flucky_elect == sum: print(flucky_elect) n += 1 # incrementing number if n > 10000: # condition to stop the loop break end = time.time() # end measuring time # output print("Total Time: %.2f seconds" % (end - start)) print("Total Loops:", iterations)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
