### Thread: hard problem

1. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Nov 2004
Posts
88
Rep Power
14

#### hard problem

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?
2. 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.
3. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2001
Location
Houston, TX
Posts
383
Rep Power
17
Originally Posted by Scorpions4ever
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.
::applause::

The answer is 4.