TITLE: Problem 2: Flip a Coin
AUTHOR: Jane Doe Email:jane.doe@cyberspace.net
DATE: Due Jan 32, 2150

# Logical name of exercise: flip_coin
# This document contains references to a parent document (../testdoc).
# These references will work for latex (using the xr package and
# a compiled parent document (with ../testdoc.aux file), but other formats
# will have missing references.
# Externaldocuments: ../testdoc


# keywords = random numbers; Monte Carlo simulation; ipynb

# Torture tests


__a)__
Make a program that simulates flipping a coin $N$ times.
Print out ``tail'' or ``head'' for each flip and
let the program count the number of heads.


__Hint 1.__
Use `r = random.random()` and define head as `r <= 0.5`.



__Hint 2.__
Draw an integer among $\{1,2\}$ with
`r = random.randint(1,2)` and define head when `r` is 1.






__b)__
Vectorize the code in a) using boolean indexing.

Vectorized code can be written in many ways.
Sometimes the code is less intuitive, sometimes not.
At least there is not much to find in Section ref{sec1}.

__c)__
Vectorize the code in a) using `numpy.sum`.



In this latter subexercise, we have an
example where the code is easy to read.


=== My remarks ===

Remarks with such a subsubsection is treated as more text
after the last subexercise. Test a list too:

 o Mark 1.
 o Mark 2.



# Closing remarks for this Problem

=== Remarks ===

These are the exercise remarks, appearing at the very end.

# solution files: mysol.txt, mysol_flip_coin.py, yet_another.file
