Simulating a Biased Coin
Redhill College's statistics seminar demonstrates a weighted coin — one machined so that it lands heads 70 times in 100 over the long run, and tails the other 30. The lecturer wants the same run of flips on the board in every seminar, so the run is generated rather than tossed: a seed is written on the slide, NumPy's classic global random stream is set from that seed, and ten flips are then produced in one weighted pick over the two faces, with heads listed first and tails second.
Task: Print the ten flips.
Input
One line holding a single integer, the seed.
Output
One line holding ten outcomes separated by single spaces, in the order they were flipped. Write heads as H and tails as T.
Example:
Input:
5
Output:
H T H T H H T H H H
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in