I'll flip you for it
Phillipa Coyne is a probability teacher who wants to show her students about random events. She asks you to write a program that flips a coin a defined number of times.
Write a Python function that conforms to the following:
- Function name
- coinFlipper()
- Parameters
- An integer representing the number of times the coin should be flipped
- Return value
- The number of times the coin comes up "heads"
- Examples
- If I flip a coin 1000 times we would EXPECT that approximately half, or 500, would be heads:
- Special Notes
- When you flip a coin there are two possible outcomes - heads and tails
- If we want to simulate the flipping of a coin we could use a random number generator and have it pick either a 1 - which we could decide is heads - or a 2 - which we could decide is tails.
- You will recall that in Scratch we could use the pick random block to accomplish this
- In Python we need to first import the random module (kind of like importing math) and then use the randint() function.
- and then