Skip to content
Advertisement

Trying to run a test to see how many children it takes to have one of each sex but the array is not working properly?

I am running some code for a class and I have no clue what to do, I submitted the assignment but it’s not helpful if I don’t know what to do in the end. Here is the code that I am running to try and track these tests. The idea is to see how many children it takes before you have at least 1 child of each sex. Then the program should be storing that to a list value as boysandgirls_stats[x]. The problem is that it won’t store all tests. It only logs around 40 out of 100 or 200 out of 1000. I don’t know where these other tests are being stored. stdarray is something we have to use from a book we are using. It tracks the tests similarly to how a list would in python but it wasn’t explained well to me. Thank you!

JavaScript

Advertisement

Answer

JavaScript

Outputs :

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement