January 13th, 2005, 05:09 PM
Ok, can someone help me write a script to simulate the following?
you have n number of kids in a room with index cards. they all fill out the cards with their names and info and pass them in to the teacher. then the teacher shuffles and passes them back. what is the probability that noone gets their own card back. come up with a formula that you can use where you can calculate the probability given that n is ANY NUMBER. so like, whats this probability when there are 2 kids (1/2), or what about 3? 4? 5? 10? 100? 1000? 9 billion?
January 13th, 2005, 05:32 PM
Please Read This First
1. Hard Problem is not a good subject title.
2. We're not exactly a free homework agency. People tend to help here, only if you show that you've done some work.
3. The equation to determine this has nothing to do with Python and everything to do with probability theory. I know how to derive it, but I'm not about to do your homework for you. Ask one of your classmates or a mathematics major for help. A good gambler may be another source of help -- a lot of them are rather well up on their probability theory fundamentals. Once you have the right formula, implementing it in python or any other language is a piece of cake.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
January 13th, 2005, 05:53 PM
Originally Posted by Scorpions4ever
The answer is 4.